annotate pidgin/gtkconv.c @ 27746:e13759a83714

propagate from branch 'im.pidgin.pidgin' (head cff05fbceab1d88163770d13a4c7a6116bdeb8ee) to branch 'im.pidgin.pidgin.yaz' (head 4c2ca466febbc129edc2012fd6ce5769696116d0)
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Sat, 15 Dec 2007 05:15:31 +0000
parents b9197011ddd6 a53f4b1813df
children 2be2eec7d273
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2 * @file gtkconv.c GTK+ Conversation API
16193
247e421c4fa6 Rename the Doxygen group from gtkui to pidgin.
Richard Laager <rlaager@wiktel.com>
parents: 16084
diff changeset
3 * @ingroup pidgin
20251
6b8bc3309ab7 applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@wiktel.com>
parents: 20199
diff changeset
4 */
6b8bc3309ab7 applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@wiktel.com>
parents: 20199
diff changeset
5
6b8bc3309ab7 applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@wiktel.com>
parents: 20199
diff changeset
6 /* pidgin
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 *
15871
66dff3dfdea6 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
8 * Pidgin is the legal property of its developers, whose names are too numerous
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 * source distribution.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 * (at your option) any later version.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 * GNU General Public License for more details.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
19680
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19668
diff changeset
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27 #include "internal.h"
15514
535f002e7b0f More pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15509
diff changeset
28 #include "pidgin.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 #ifndef _WIN32
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 # include <X11/Xlib.h>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34 #ifdef USE_GTKSPELL
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35 # include <gtkspell/gtkspell.h>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 # ifdef _WIN32
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37 # include "wspell.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38 # endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41 #include <gdk/gdkkeysyms.h>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43 #include "account.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44 #include "cmds.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45 #include "debug.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46 #include "idle.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47 #include "imgstore.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48 #include "log.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49 #include "notify.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50 #include "prpl.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51 #include "request.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52 #include "util.h"
17846
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
53 #include "version.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55 #include "gtkdnd-hints.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
56 #include "gtkblist.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57 #include "gtkconv.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58 #include "gtkconvwin.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59 #include "gtkdialogs.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60 #include "gtkimhtml.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
61 #include "gtkimhtmltoolbar.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
62 #include "gtklog.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
63 #include "gtkmenutray.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
64 #include "gtkpounce.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65 #include "gtkprefs.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
66 #include "gtkprivacy.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
67 #include "gtkthemes.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
68 #include "gtkutils.h"
15822
84b0f9b23ede According to etags, pidgin/ should be completely clean of references to 'gaim' as a client
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
69 #include "pidginstock.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
70
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
71 #include "gtknickcolors.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72
19900
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
73 #define CLOSE_CONV_TIMEOUT_SECS (10 * 60)
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
74
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
75 #define AUTO_RESPONSE "&lt;AUTO-REPLY&gt; : "
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
76
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
77 typedef enum
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
78 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
79 PIDGIN_CONV_SET_TITLE = 1 << 0,
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
80 PIDGIN_CONV_BUDDY_ICON = 1 << 1,
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
81 PIDGIN_CONV_MENU = 1 << 2,
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
82 PIDGIN_CONV_TAB_ICON = 1 << 3,
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
83 PIDGIN_CONV_TOPIC = 1 << 4,
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
84 PIDGIN_CONV_SMILEY_THEME = 1 << 5,
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
85 PIDGIN_CONV_COLORIZE_TITLE = 1 << 6
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
86 }PidginConvFields;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
87
18181
a8c701d877aa Start work on blist pane in conversation. Looks like: http://pidgin.im/~seanegan/infopane.png Certainly much to be done yet.
Sean Egan <seanegan@gmail.com>
parents: 18167
diff changeset
88 enum {
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
89 CONV_ICON_COLUMN,
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
90 CONV_TEXT_COLUMN,
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
91 CONV_EMBLEM_COLUMN,
19474
74befdcd0454 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@gmail.com>
parents: 19468
diff changeset
92 CONV_PROTOCOL_ICON_COLUMN,
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
93 CONV_NUM_COLUMNS
18181
a8c701d877aa Start work on blist pane in conversation. Looks like: http://pidgin.im/~seanegan/infopane.png Certainly much to be done yet.
Sean Egan <seanegan@gmail.com>
parents: 18167
diff changeset
94 } PidginInfopaneColumns;
a8c701d877aa Start work on blist pane in conversation. Looks like: http://pidgin.im/~seanegan/infopane.png Certainly much to be done yet.
Sean Egan <seanegan@gmail.com>
parents: 18167
diff changeset
95
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
96 #define PIDGIN_CONV_ALL ((1 << 7) - 1)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
98 #define SEND_COLOR "#204a87"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99 #define RECV_COLOR "#cc0000"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100 #define HIGHLIGHT_COLOR "#AF7F00"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102 /* Undef this to turn off "custom-smiley" debug messages */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103 #define DEBUG_CUSTOM_SMILEY
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105 #define LUMINANCE(c) (float)((0.3*(c.red))+(0.59*(c.green))+(0.11*(c.blue)))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 /* From http://www.w3.org/TR/AERT#color-contrast */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108 #define MIN_BRIGHTNESS_CONTRAST 75
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109 #define MIN_COLOR_CONTRAST 200
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 #define NUM_NICK_COLORS 220
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 static GdkColor *nick_colors = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113 static guint nbr_nick_colors;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114
25467
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 16358
diff changeset
115 /* yaz. If you want to use shortcut keys that may conflict with
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 16358
diff changeset
116 inputmethods, change this to 1. */
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 16358
diff changeset
117 #define ENABLE_SHORTCUT 0
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 16358
diff changeset
118
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119 typedef struct {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
120 GtkWidget *window;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122 GtkWidget *entry;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123 GtkWidget *message;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
125 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127 } InviteBuddyInfo;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129 static GtkWidget *invite_dialog = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130 static GtkWidget *warn_close_dialog = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
132 static PidginWindow *hidden_convwin = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133 static GList *window_list = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
135 /* Lists of status icons at all available sizes for use as window icons */
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
136 static GList *available_list = NULL;
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
137 static GList *away_list = NULL;
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
138 static GList *busy_list = NULL;
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
139 static GList *xa_list = NULL;
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
140 static GList *login_list = NULL;
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
141 static GList *logout_list = NULL;
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
142 static GList *offline_list = NULL;
15724
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
143 static GHashTable *prpl_lists = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
144
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
145 static gboolean update_send_to_selection(PidginWindow *win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
146 static void generate_send_to_items(PidginWindow *win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
147
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148 /* Prototypes. <-- because Paco-Paco hates this comment. */
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
149 static gboolean infopane_entry_activate(PidginConversation *gtkconv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
150 static void got_typing_keypress(PidginConversation *gtkconv, gboolean first);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
151 static void gray_stuff_out(PidginConversation *gtkconv);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
152 static GList *generate_invite_user_names(PurpleConnection *gc);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
153 static void add_chat_buddy_common(PurpleConversation *conv, PurpleConvChatBuddy *cb, const char *old_name);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
154 static gboolean tab_complete(PurpleConversation *conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
155 static void pidgin_conv_updated(PurpleConversation *conv, PurpleConvUpdateType type);
20953
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
156 static void conv_set_unseen(PurpleConversation *gtkconv, PidginUnseenState state);
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
157 static void gtkconv_set_unseen(PidginConversation *gtkconv, PidginUnseenState state);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
158 static void update_typing_icon(PidginConversation *gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
159 static const char *item_factory_translate_func (const char *path, gpointer func_data);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
160 gboolean pidgin_conv_has_focus(PurpleConversation *conv);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
161 static void pidgin_conv_custom_smiley_allocated(GdkPixbufLoader *loader, gpointer user_data);
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
162 static void pidgin_conv_custom_smiley_closed(GdkPixbufLoader *loader, gpointer user_data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
163 static GdkColor* generate_nick_colors(guint *numcolors, GdkColor background);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
164 static gboolean color_is_visible(GdkColor foreground, GdkColor background, int color_contrast, int brightness_contrast);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
165 static void pidgin_conv_update_fields(PurpleConversation *conv, PidginConvFields fields);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
166 static void focus_out_from_menubar(GtkWidget *wid, PidginWindow *win);
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
167 static void pidgin_conv_tab_pack(PidginWindow *win, PidginConversation *gtkconv);
18227
cbc89a49e43b Treat infopanes just like tabs for purposes of drag-and-drop. Then, don't show a tab for windows with only one tab, as the infopane serves the purpose better
Sean Egan <seanegan@gmail.com>
parents: 18218
diff changeset
168 static gboolean infopane_press_cb(GtkWidget *widget, GdkEventButton *e, PidginConversation *conv);
19588
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
169 static gboolean pidgin_userlist_motion_cb (GtkWidget *w, GdkEventMotion *event, PidginConversation *gtkconv);
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
170 static void pidgin_conv_leave_cb (GtkWidget *w, GdkEventCrossing *e, PidginConversation *gtkconv);
19900
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
171 static void hide_conv(PidginConversation *gtkconv, gboolean closetimer);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
172
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
173 static void pidgin_conv_set_position_size(PidginWindow *win, int x, int y,
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
174 int width, int height);
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
175
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
176 static GdkColor *get_nick_color(PidginConversation *gtkconv, const char *name) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
177 static GdkColor col;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
178 GtkStyle *style = gtk_widget_get_style(gtkconv->imhtml);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
179 float scale;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
181 col = nick_colors[g_str_hash(name) % nbr_nick_colors];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182 scale = ((1-(LUMINANCE(style->base[GTK_STATE_NORMAL]) / LUMINANCE(style->white))) *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
183 (LUMINANCE(style->white)/MAX(MAX(col.red, col.blue), col.green)));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185 /* The colors are chosen to look fine on white; we should never have to darken */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186 if (scale > 1) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187 col.red *= scale;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188 col.green *= scale;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
189 col.blue *= scale;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
190 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
192 return &col;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
193 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
194
19980
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
195 static PurpleBlistNode *
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
196 get_conversation_blist_node(PurpleConversation *conv)
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
197 {
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
198 PurpleBlistNode *node = NULL;
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
199
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
200 switch (purple_conversation_get_type(conv)) {
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
201 case PURPLE_CONV_TYPE_IM:
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
202 node = (PurpleBlistNode*)purple_find_buddy(conv->account, conv->name);
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
203 node = node ? node->parent : NULL;
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
204 break;
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
205 case PURPLE_CONV_TYPE_CHAT:
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
206 node = (PurpleBlistNode*)purple_blist_find_chat(conv->account, conv->name);
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
207 break;
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
208 default:
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
209 break;
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
210 }
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
211 return node;
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
212 }
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
213
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215 * Callbacks
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
217
18797
0622a7f08dde smaller close buttons on tabs. I think this looks really good.
Sean Egan <seanegan@gmail.com>
parents: 18796
diff changeset
218 static gboolean
19900
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
219 close_this_sucker(gpointer data)
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
220 {
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
221 PidginConversation *gtkconv = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
222 GList *list = g_list_copy(gtkconv->convs);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
223 g_list_foreach(list, (GFunc)purple_conversation_destroy, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
224 g_list_free(list);
19900
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
225 return FALSE;
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
226 }
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
227
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
228 static gboolean
20077
fee0eea83e58 Honour the persistency when closing the window from the WM.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20051
diff changeset
229 close_conv_cb(GtkWidget *w, GdkEventButton *dontuse, PidginConversation *gtkconv)
19900
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
230 {
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
231 /* We are going to destroy the conversations immediately only if the 'close immediately'
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
232 * preference is selected. Otherwise, close the conversation after a reasonable timeout
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
233 * (I am going to consider 10 minutes as a 'reasonable timeout' here.
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
234 * For chats, close immediately if the chat is not in the buddylist, or if the chat is
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
235 * not marked 'Persistent' */
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
236 PurpleConversation *conv = gtkconv->active_conv;
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
237 PurpleAccount *account = purple_conversation_get_account(conv);
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
238 const char *name = purple_conversation_get_name(conv);
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
239
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
240 switch (purple_conversation_get_type(conv)) {
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
241 case PURPLE_CONV_TYPE_IM:
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
242 {
21664
c9946b9965c9 Kevin says we're ok defaulting persistent IMs on
Sean Egan <seanegan@gmail.com>
parents: 21661
diff changeset
243 hide_conv(gtkconv, TRUE);
21671
12b165b013e4 Fix a crash.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21665
diff changeset
244 break;
19900
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
245 }
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
246 case PURPLE_CONV_TYPE_CHAT:
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
247 {
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
248 PurpleChat *chat = purple_blist_find_chat(account, name);
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
249 if (!chat ||
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
250 !purple_blist_node_get_bool(&chat->node, "gtk-persistent"))
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
251 close_this_sucker(gtkconv);
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
252 else
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
253 hide_conv(gtkconv, FALSE);
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
254 break;
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
255 }
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
256 default:
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
257 ;
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
258 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
259
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
260 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
261 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
262
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
263 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
264 lbox_size_allocate_cb(GtkWidget *w, GtkAllocation *allocation, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
265 {
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
266 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/chat/userlist_width", allocation->width == 1 ? 0 : allocation->width);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
267
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
268 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
269 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
271 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
272 size_allocate_cb(GtkWidget *w, GtkAllocation *allocation, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
273 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
274 PurpleConversation *conv = gtkconv->active_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
275
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
276 if (!GTK_WIDGET_VISIBLE(w))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
277 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
278
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
279 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
280 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
281 if (gtkconv->auto_resize) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
282 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
283 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
284
17493
bfdc5995d54a Don't save conversation window size to prefs if the window is maximized. Fixes #920
Sean Egan <seanegan@gmail.com>
parents: 17489
diff changeset
285 if (gdk_window_get_state(gtkconv->win->window->window) & GDK_WINDOW_STATE_MAXIMIZED) {
bfdc5995d54a Don't save conversation window size to prefs if the window is maximized. Fixes #920
Sean Egan <seanegan@gmail.com>
parents: 17489
diff changeset
286 return FALSE;
bfdc5995d54a Don't save conversation window size to prefs if the window is maximized. Fixes #920
Sean Egan <seanegan@gmail.com>
parents: 17489
diff changeset
287 }
bfdc5995d54a Don't save conversation window size to prefs if the window is maximized. Fixes #920
Sean Egan <seanegan@gmail.com>
parents: 17489
diff changeset
288
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
289 /* I find that I resize the window when it has a bunch of conversations in it, mostly so that the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
290 * tab bar will fit, but then I don't want new windows taking up the entire screen. I check to see
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
291 * if there is only one conversation in the window. This way we'll be setting new windows to the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
292 * size of the last resized new window. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
293 /* I think that the above justification is not the majority, and that the new tab resizing should
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
294 * negate it anyway. --luke */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
295 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
296 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
297 if (w == gtkconv->lower_hbox)
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
298 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/im/entry_height", allocation->height);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
299 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
300 else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
301 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
302 if (w == gtkconv->lower_hbox)
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
303 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/chat/entry_height", allocation->height);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
304 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
305 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
306 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
307
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
308 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
309 default_formatize(PidginConversation *c)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
310 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
311 PurpleConversation *conv = c->active_conv;
17517
274ceb453176 Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17399
diff changeset
312 gtk_imhtml_setup_entry(GTK_IMHTML(c->entry), conv->features);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
313 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
314
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
315 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
316 clear_formatting_cb(GtkIMHtml *imhtml, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
317 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
318 default_formatize(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
319 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
320
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
321 static const char *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
322 pidgin_get_cmd_prefix(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
323 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
324 return "/";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
325 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
326
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
327 static PurpleCmdRet
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
328 say_command_cb(PurpleConversation *conv,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
329 const char *cmd, char **args, char **error, void *data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
330 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
331 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
332 purple_conv_im_send(PURPLE_CONV_IM(conv), args[0]);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
333 else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
334 purple_conv_chat_send(PURPLE_CONV_CHAT(conv), args[0]);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
335
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
336 return PURPLE_CMD_RET_OK;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
337 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
338
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
339 static PurpleCmdRet
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
340 me_command_cb(PurpleConversation *conv,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
341 const char *cmd, char **args, char **error, void *data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
342 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
343 char *tmp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
344
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
345 tmp = g_strdup_printf("/me %s", args[0]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
346
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
347 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
348 purple_conv_im_send(PURPLE_CONV_IM(conv), tmp);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
349 else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
350 purple_conv_chat_send(PURPLE_CONV_CHAT(conv), tmp);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
351
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
352 g_free(tmp);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
353 return PURPLE_CMD_RET_OK;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
354 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
355
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
356 static PurpleCmdRet
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
357 debug_command_cb(PurpleConversation *conv,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
358 const char *cmd, char **args, char **error, void *data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
359 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
360 char *tmp, *markup;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
361 PurpleCmdStatus status;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
362
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
363 if (!g_ascii_strcasecmp(args[0], "version")) {
21030
3cc856ca2338 Add a --with-extraversion option to ./configure so packagers can fine tune
Stu Tomlinson <stu@nosnilmot.com>
parents: 21008
diff changeset
364 tmp = g_strdup_printf("me is using %s v%s.", "Pidgin", DISPLAY_VERSION);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
365 markup = g_markup_escape_text(tmp, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
366
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
367 status = purple_cmd_do_command(conv, tmp, markup, error);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
368
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
369 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
370 g_free(markup);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
371 return status;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
372 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
373 purple_conversation_write(conv, NULL, _("Supported debug options are: version"),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
374 PURPLE_MESSAGE_NO_LOG|PURPLE_MESSAGE_ERROR, time(NULL));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
375 return PURPLE_CMD_STATUS_OK;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
376 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
377 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
378
18296
65cd831b39cd Patch from jeff to add a 'clearall' command to clear all the scrollbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18263
diff changeset
379 static void clear_conversation_scrollback(PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
380 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
381 PidginConversation *gtkconv = NULL;
20172
a112d292be7f Clear the conversation history for all the purple-convs in a pidgin-conv.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20103
diff changeset
382 GList *iter;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
383
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
384 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
385
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
386 gtk_imhtml_clear(GTK_IMHTML(gtkconv->imhtml));
20172
a112d292be7f Clear the conversation history for all the purple-convs in a pidgin-conv.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20103
diff changeset
387 for (iter = gtkconv->convs; iter; iter = iter->next)
a112d292be7f Clear the conversation history for all the purple-convs in a pidgin-conv.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20103
diff changeset
388 purple_conversation_clear_message_history(iter->data);
18296
65cd831b39cd Patch from jeff to add a 'clearall' command to clear all the scrollbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18263
diff changeset
389 }
65cd831b39cd Patch from jeff to add a 'clearall' command to clear all the scrollbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18263
diff changeset
390
65cd831b39cd Patch from jeff to add a 'clearall' command to clear all the scrollbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18263
diff changeset
391 static PurpleCmdRet
65cd831b39cd Patch from jeff to add a 'clearall' command to clear all the scrollbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18263
diff changeset
392 clear_command_cb(PurpleConversation *conv,
65cd831b39cd Patch from jeff to add a 'clearall' command to clear all the scrollbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18263
diff changeset
393 const char *cmd, char **args, char **error, void *data)
65cd831b39cd Patch from jeff to add a 'clearall' command to clear all the scrollbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18263
diff changeset
394 {
65cd831b39cd Patch from jeff to add a 'clearall' command to clear all the scrollbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18263
diff changeset
395 clear_conversation_scrollback(conv);
65cd831b39cd Patch from jeff to add a 'clearall' command to clear all the scrollbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18263
diff changeset
396 return PURPLE_CMD_STATUS_OK;
65cd831b39cd Patch from jeff to add a 'clearall' command to clear all the scrollbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18263
diff changeset
397 }
65cd831b39cd Patch from jeff to add a 'clearall' command to clear all the scrollbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18263
diff changeset
398
65cd831b39cd Patch from jeff to add a 'clearall' command to clear all the scrollbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18263
diff changeset
399 static PurpleCmdRet
65cd831b39cd Patch from jeff to add a 'clearall' command to clear all the scrollbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18263
diff changeset
400 clearall_command_cb(PurpleConversation *conv,
65cd831b39cd Patch from jeff to add a 'clearall' command to clear all the scrollbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18263
diff changeset
401 const char *cmd, char **args, char **error, void *data)
65cd831b39cd Patch from jeff to add a 'clearall' command to clear all the scrollbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18263
diff changeset
402 {
65cd831b39cd Patch from jeff to add a 'clearall' command to clear all the scrollbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18263
diff changeset
403 purple_conversation_foreach(clear_conversation_scrollback);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
404 return PURPLE_CMD_STATUS_OK;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
405 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
406
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
407 static PurpleCmdRet
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
408 help_command_cb(PurpleConversation *conv,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
409 const char *cmd, char **args, char **error, void *data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
410 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
411 GList *l, *text;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
412 GString *s;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
413
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
414 if (args[0] != NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
415 s = g_string_new("");
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
416 text = purple_cmd_help(conv, args[0]);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
417
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
418 if (text) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
419 for (l = text; l; l = l->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
420 if (l->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
421 g_string_append_printf(s, "%s\n", (char *)l->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
422 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
423 g_string_append_printf(s, "%s", (char *)l->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
424 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
425 g_string_append(s, _("No such command (in this context)."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
426 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
427 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
428 s = g_string_new(_("Use \"/help &lt;command&gt;\" for help on a specific command.\n"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
429 "The following commands are available in this context:\n"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
430
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
431 text = purple_cmd_list(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
432 for (l = text; l; l = l->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
433 if (l->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
434 g_string_append_printf(s, "%s, ", (char *)l->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
435 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
436 g_string_append_printf(s, "%s.", (char *)l->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
437 g_list_free(text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
438 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
439
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
440 purple_conversation_write(conv, NULL, s->str, PURPLE_MESSAGE_NO_LOG, time(NULL));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
441 g_string_free(s, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
442
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
443 return PURPLE_CMD_STATUS_OK;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
444 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
445
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
446 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
447 send_history_add(PidginConversation *gtkconv, const char *message)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
448 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
449 GList *first;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
450
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
451 first = g_list_first(gtkconv->send_history);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
452 g_free(first->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
453 first->data = g_strdup(message);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
454 gtkconv->send_history = g_list_prepend(first, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
455 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
456
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
457 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
458 reset_default_size(PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
459 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
460 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
461 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
462 gtk_widget_set_size_request(gtkconv->lower_hbox, -1,
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
463 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/chat/entry_height"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
464 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
465 gtk_widget_set_size_request(gtkconv->lower_hbox, -1,
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
466 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/im/entry_height"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
467 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
468
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
469 static gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
470 check_for_and_do_command(PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
471 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
472 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
473 char *cmd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
474 const char *prefix;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
475 GtkTextIter start;
18030
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
476 gboolean retval = FALSE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
477
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
478 gtkconv = PIDGIN_CONVERSATION(conv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
479 prefix = pidgin_get_cmd_prefix();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
480
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
481 cmd = gtk_imhtml_get_text(GTK_IMHTML(gtkconv->entry), NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
482 gtk_text_buffer_get_start_iter(GTK_IMHTML(gtkconv->entry)->text_buffer, &start);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
483
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
484 if (cmd && (strncmp(cmd, prefix, strlen(prefix)) == 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
485 && !gtk_text_iter_get_child_anchor(&start)) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
486 PurpleCmdStatus status;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
487 char *error, *cmdline, *markup, *send_history;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
488 GtkTextIter end;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
489
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
490 send_history = gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
491 send_history_add(gtkconv, send_history);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
492 g_free(send_history);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
493
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
494 cmdline = cmd + strlen(prefix);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
495
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
496 gtk_text_iter_forward_chars(&start, g_utf8_strlen(prefix, -1));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
497 gtk_text_buffer_get_end_iter(GTK_IMHTML(gtkconv->entry)->text_buffer, &end);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
498 markup = gtk_imhtml_get_markup_range(GTK_IMHTML(gtkconv->entry), &start, &end);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
499 status = purple_cmd_do_command(conv, cmdline, markup, &error);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
500 g_free(markup);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
501
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
502 switch (status) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
503 case PURPLE_CMD_STATUS_OK:
18030
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
504 retval = TRUE;
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
505 break;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
506 case PURPLE_CMD_STATUS_NOT_FOUND:
18030
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
507 {
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
508 PurplePluginProtocolInfo *prpl_info = NULL;
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
509 PurpleConnection *gc;
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
510
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
511 if ((gc = purple_conversation_get_gc(conv)))
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
512 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
513
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
514 if ((prpl_info != NULL) && (prpl_info->options & OPT_PROTO_SLASH_COMMANDS_NATIVE)) {
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
515 char *firstspace;
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
516 char *slash;
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
517
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
518 firstspace = strchr(cmdline, ' ');
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
519 if (firstspace != NULL) {
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
520 slash = strrchr(firstspace, '/');
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
521 } else {
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
522 slash = strchr(cmdline, '/');
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
523 }
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
524
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
525 if (slash == NULL) {
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
526 purple_conversation_write(conv, "", _("Unknown command."), PURPLE_MESSAGE_NO_LOG, time(NULL));
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
527 retval = TRUE;
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
528 }
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
529 }
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
530 break;
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
531 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
532 case PURPLE_CMD_STATUS_WRONG_ARGS:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
533 purple_conversation_write(conv, "", _("Syntax Error: You typed the wrong number of arguments "
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
534 "to that command."),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
535 PURPLE_MESSAGE_NO_LOG, time(NULL));
18030
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
536 retval = TRUE;
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
537 break;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
538 case PURPLE_CMD_STATUS_FAILED:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
539 purple_conversation_write(conv, "", error ? error : _("Your command failed for an unknown reason."),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
540 PURPLE_MESSAGE_NO_LOG, time(NULL));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
541 g_free(error);
18030
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
542 retval = TRUE;
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
543 break;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
544 case PURPLE_CMD_STATUS_WRONG_TYPE:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
545 if(purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
546 purple_conversation_write(conv, "", _("That command only works in chats, not IMs."),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
547 PURPLE_MESSAGE_NO_LOG, time(NULL));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
548 else
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
549 purple_conversation_write(conv, "", _("That command only works in IMs, not chats."),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
550 PURPLE_MESSAGE_NO_LOG, time(NULL));
18030
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
551 retval = TRUE;
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
552 break;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
553 case PURPLE_CMD_STATUS_WRONG_PRPL:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
554 purple_conversation_write(conv, "", _("That command doesn't work on this protocol."),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
555 PURPLE_MESSAGE_NO_LOG, time(NULL));
18030
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
556 retval = TRUE;
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
557 break;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
558 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
559 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
560
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
561 g_free(cmd);
18030
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
562 return retval;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
563 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
564
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
565 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
566 send_cb(GtkWidget *widget, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
567 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
568 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
569 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
570 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
571 PurpleMessageFlags flags = 0;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
572 char *buf, *clean;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
573
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
574 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
575
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
576 if (check_for_and_do_command(conv)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
577 if (gtkconv->entry_growing) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
578 reset_default_size(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
579 gtkconv->entry_growing = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
580 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
581 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
582 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
583 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
584
18297
73b3da7608f5 Executing a command doesn't require to be active in the chat or the account
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18296
diff changeset
585 if ((purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) &&
73b3da7608f5 Executing a command doesn't require to be active in the chat or the account
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18296
diff changeset
586 purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv)))
73b3da7608f5 Executing a command doesn't require to be active in the chat or the account
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18296
diff changeset
587 return;
73b3da7608f5 Executing a command doesn't require to be active in the chat or the account
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18296
diff changeset
588
73b3da7608f5 Executing a command doesn't require to be active in the chat or the account
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18296
diff changeset
589 if (!purple_account_is_connected(account))
73b3da7608f5 Executing a command doesn't require to be active in the chat or the account
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18296
diff changeset
590 return;
73b3da7608f5 Executing a command doesn't require to be active in the chat or the account
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18296
diff changeset
591
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
592 buf = gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
593 clean = gtk_imhtml_get_text(GTK_IMHTML(gtkconv->entry), NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
594
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
595 gtk_widget_grab_focus(gtkconv->entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
596
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
597 if (strlen(clean) == 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
598 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
599 g_free(clean);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
600 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
601 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
602
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
603 purple_idle_touch();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
604
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
605 /* XXX: is there a better way to tell if the message has images? */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
606 if (GTK_IMHTML(gtkconv->entry)->im_images != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
607 flags |= PURPLE_MESSAGE_IMAGES;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
608
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
609 gc = purple_account_get_connection(account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
610 if (gc && (conv->features & PURPLE_CONNECTION_NO_NEWLINES)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
611 char **bufs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
612 int i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
613
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
614 bufs = gtk_imhtml_get_markup_lines(GTK_IMHTML(gtkconv->entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
615 for (i = 0; bufs[i]; i++) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
616 send_history_add(gtkconv, bufs[i]);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
617 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
618 purple_conv_im_send_with_flags(PURPLE_CONV_IM(conv), bufs[i], flags);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
619 else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
620 purple_conv_chat_send_with_flags(PURPLE_CONV_CHAT(conv), bufs[i], flags);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
621 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
622
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
623 g_strfreev(bufs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
624
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
625 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
626 send_history_add(gtkconv, buf);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
627 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
628 purple_conv_im_send_with_flags(PURPLE_CONV_IM(conv), buf, flags);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
629 else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
630 purple_conv_chat_send_with_flags(PURPLE_CONV_CHAT(conv), buf, flags);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
631 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
632
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
633 g_free(clean);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
634 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
635
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
636 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
637 if (gtkconv->entry_growing) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
638 reset_default_size(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
639 gtkconv->entry_growing = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
640 }
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
641 gtkconv_set_unseen(gtkconv, PIDGIN_UNSEEN_NONE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
642 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
643
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
644 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
645 add_remove_cb(GtkWidget *widget, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
646 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
647 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
648 const char *name;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
649 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
650
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
651 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
652 name = purple_conversation_get_name(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
653
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
654 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
655 PurpleBuddy *b;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
656
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
657 b = purple_find_buddy(account, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
658 if (b != NULL)
16202
0973688f4b74 Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@wiktel.com>
parents: 16193
diff changeset
659 pidgin_dialogs_remove_buddy(b);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
660 else if (account != NULL && purple_account_is_connected(account))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
661 purple_blist_request_add_buddy(account, (char *)name, NULL, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
662 } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
663 PurpleChat *c;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
664
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
665 c = purple_blist_find_chat(account, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
666 if (c != NULL)
16202
0973688f4b74 Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@wiktel.com>
parents: 16193
diff changeset
667 pidgin_dialogs_remove_chat(c);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
668 else if (account != NULL && purple_account_is_connected(account))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
669 purple_blist_request_add_chat(account, NULL, NULL, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
670 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
671
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
672 gtk_widget_grab_focus(PIDGIN_CONVERSATION(conv)->entry);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
673 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
674
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
675 static void chat_do_info(PidginConversation *gtkconv, const char *who)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
676 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
677 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
678 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
679
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
680 if ((gc = purple_conversation_get_gc(conv))) {
18218
571e0ca28d6c Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18215
diff changeset
681 pidgin_retrieve_user_info_in_chat(gc, who, purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
682 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
683 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
684
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
685
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
686 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
687 info_cb(GtkWidget *widget, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
688 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
689 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
690
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
691 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) {
17275
319bcb73eb4e Use utility functions to get user info. Closes #964.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17257
diff changeset
692 pidgin_retrieve_user_info(purple_conversation_get_gc(conv),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
693 purple_conversation_get_name(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
694 gtk_widget_grab_focus(gtkconv->entry);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
695 } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
696 /* Get info of the person currently selected in the GtkTreeView */
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
697 PidginChatPane *gtkchat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
698 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
699 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
700 GtkTreeSelection *sel;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
701 char *name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
702
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
703 gtkchat = gtkconv->u.chat;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
704
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
705 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
706 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
707
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
708 if (gtk_tree_selection_get_selected(sel, NULL, &iter))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
709 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &name, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
710 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
711 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
712
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
713 chat_do_info(gtkconv, name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
714 g_free(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
715 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
716 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
717
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
718 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
719 block_cb(GtkWidget *widget, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
720 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
721 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
722 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
723
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
724 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
725
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
726 if (account != NULL && purple_account_is_connected(account))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
727 pidgin_request_add_block(account, purple_conversation_get_name(conv));
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
728
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
729 gtk_widget_grab_focus(PIDGIN_CONVERSATION(conv)->entry);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
730 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
731
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
732 static void
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
733 unblock_cb(GtkWidget *widget, PidginConversation *gtkconv)
15426
c9497aad9fc4 Warmenhoved patch #1397916: "Turns Block button in conv menu into Unblock after blocking" from Glauber de Oliveira Costa (glommer). You know the drill.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15374
diff changeset
734 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
735 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
736 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
737
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
738 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
739
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
740 if (account != NULL && purple_account_is_connected(account))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
741 pidgin_request_add_permit(account, purple_conversation_get_name(conv));
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
742
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
743 gtk_widget_grab_focus(PIDGIN_CONVERSATION(conv)->entry);
15426
c9497aad9fc4 Warmenhoved patch #1397916: "Turns Block button in conv menu into Unblock after blocking" from Glauber de Oliveira Costa (glommer). You know the drill.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15374
diff changeset
744 }
c9497aad9fc4 Warmenhoved patch #1397916: "Turns Block button in conv menu into Unblock after blocking" from Glauber de Oliveira Costa (glommer). You know the drill.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15374
diff changeset
745
c9497aad9fc4 Warmenhoved patch #1397916: "Turns Block button in conv menu into Unblock after blocking" from Glauber de Oliveira Costa (glommer). You know the drill.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15374
diff changeset
746 static void
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
747 do_invite(GtkWidget *w, int resp, InviteBuddyInfo *info)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
748 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
749 const char *buddy, *message;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
750 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
751
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
752 gtkconv = PIDGIN_CONVERSATION(info->conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
753
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
754 if (resp == GTK_RESPONSE_OK) {
20028
a2b4eac83902 Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19980
diff changeset
755 buddy = pidgin_text_combo_box_entry_get_text(info->entry);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
756 message = gtk_entry_get_text(GTK_ENTRY(info->message));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
757
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
758 if (!g_ascii_strcasecmp(buddy, ""))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
759 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
760
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
761 serv_chat_invite(purple_conversation_get_gc(info->conv),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
762 purple_conv_chat_get_id(PURPLE_CONV_CHAT(info->conv)),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
763 message, buddy);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
764 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
765
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
766 gtk_widget_destroy(invite_dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
767 invite_dialog = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
768
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
769 g_free(info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
770 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
771
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
772 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
773 invite_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
774 GtkSelectionData *sd, guint inf, guint t, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
775 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
776 InviteBuddyInfo *info = (InviteBuddyInfo *)data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
777 const char *convprotocol;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
778
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
779 convprotocol = purple_account_get_protocol_id(purple_conversation_get_account(info->conv));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
780
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
781 if (sd->target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
782 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
783 PurpleBlistNode *node = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
784 PurpleBuddy *buddy;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
785
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
786 memcpy(&node, sd->data, sizeof(node));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
787
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
788 if (PURPLE_BLIST_NODE_IS_CONTACT(node))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
789 buddy = purple_contact_get_priority_buddy((PurpleContact *)node);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
790 else if (PURPLE_BLIST_NODE_IS_BUDDY(node))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
791 buddy = (PurpleBuddy *)node;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
792 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
793 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
794
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
795 if (strcmp(convprotocol, purple_account_get_protocol_id(buddy->account)))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
796 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
797 purple_notify_error(PIDGIN_CONVERSATION(info->conv), NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
798 _("That buddy is not on the same protocol as this "
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
799 "chat."), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
800 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
801 else
20028
a2b4eac83902 Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19980
diff changeset
802 pidgin_text_combo_box_entry_set_text(info->entry, buddy->name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
803
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
804 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
805 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
806 else if (sd->target == gdk_atom_intern("application/x-im-contact", FALSE))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
807 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
808 char *protocol = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
809 char *username = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
810 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
811
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
812 if (pidgin_parse_x_im_contact((const char *)sd->data, FALSE, &account,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
813 &protocol, &username, NULL))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
814 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
815 if (account == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
816 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
817 purple_notify_error(PIDGIN_CONVERSATION(info->conv), NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
818 _("You are not currently signed on with an account that "
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
819 "can invite that buddy."), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
820 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
821 else if (strcmp(convprotocol, purple_account_get_protocol_id(account)))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
822 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
823 purple_notify_error(PIDGIN_CONVERSATION(info->conv), NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
824 _("That buddy is not on the same protocol as this "
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
825 "chat."), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
826 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
827 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
828 {
20028
a2b4eac83902 Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19980
diff changeset
829 pidgin_text_combo_box_entry_set_text(info->entry, username);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
830 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
831 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
832
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
833 g_free(username);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
834 g_free(protocol);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
835
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
836 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
837 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
838 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
839
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
840 static const GtkTargetEntry dnd_targets[] =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
841 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
842 {"PURPLE_BLIST_NODE", GTK_TARGET_SAME_APP, 0},
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
843 {"application/x-im-contact", 0, 1}
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
844 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
845
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
846 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
847 invite_cb(GtkWidget *widget, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
848 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
849 PurpleConversation *conv = gtkconv->active_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
850 InviteBuddyInfo *info = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
851
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
852 if (invite_dialog == NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
853 PurpleConnection *gc;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
854 PidginWindow *gtkwin;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
855 GtkWidget *label;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
856 GtkWidget *vbox, *hbox;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
857 GtkWidget *table;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
858 GtkWidget *img;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
859
15436
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15435
diff changeset
860 img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_QUESTION,
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15435
diff changeset
861 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_HUGE));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
862
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
863 info = g_new0(InviteBuddyInfo, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
864 info->conv = conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
865
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
866 gc = purple_conversation_get_gc(conv);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
867 gtkwin = pidgin_conv_get_window(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
868
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
869 /* Create the new dialog. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
870 invite_dialog = gtk_dialog_new_with_buttons(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
871 _("Invite Buddy Into Chat Room"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
872 GTK_WINDOW(gtkwin->window), 0,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
873 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
15509
23ca11f8a8c4 stock to pidgin
Sean Egan <seanegan@gmail.com>
parents: 15508
diff changeset
874 PIDGIN_STOCK_INVITE, GTK_RESPONSE_OK, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
875
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
876 gtk_dialog_set_default_response(GTK_DIALOG(invite_dialog),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
877 GTK_RESPONSE_OK);
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
878 gtk_container_set_border_width(GTK_CONTAINER(invite_dialog), PIDGIN_HIG_BOX_SPACE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
879 gtk_window_set_resizable(GTK_WINDOW(invite_dialog), FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
880 gtk_dialog_set_has_separator(GTK_DIALOG(invite_dialog), FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
881
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
882 info->window = GTK_WIDGET(invite_dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
883
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
884 /* Setup the outside spacing. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
885 vbox = GTK_DIALOG(invite_dialog)->vbox;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
886
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
887 gtk_box_set_spacing(GTK_BOX(vbox), PIDGIN_HIG_BORDER);
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
888 gtk_container_set_border_width(GTK_CONTAINER(vbox), PIDGIN_HIG_BOX_SPACE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
889
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
890 /* Setup the inner hbox and put the dialog's icon in it. */
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
891 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
892 gtk_container_add(GTK_CONTAINER(vbox), hbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
893 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
894 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
895
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
896 /* Setup the right vbox. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
897 vbox = gtk_vbox_new(FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
898 gtk_container_add(GTK_CONTAINER(hbox), vbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
899
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
900 /* Put our happy label in it. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
901 label = gtk_label_new(_("Please enter the name of the user you wish "
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
902 "to invite, along with an optional invite "
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
903 "message."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
904 gtk_widget_set_size_request(label, 350, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
905 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
906 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
907 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
908
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
909 /* hbox for the table, and to give it some spacing on the left. */
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
910 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
911 gtk_container_add(GTK_CONTAINER(vbox), hbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
912
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
913 /* Setup the table we're going to use to lay stuff out. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
914 table = gtk_table_new(2, 2, FALSE);
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
915 gtk_table_set_row_spacings(GTK_TABLE(table), PIDGIN_HIG_BOX_SPACE);
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
916 gtk_table_set_col_spacings(GTK_TABLE(table), PIDGIN_HIG_BOX_SPACE);
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
917 gtk_container_set_border_width(GTK_CONTAINER(table), PIDGIN_HIG_BORDER);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
918 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
919
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
920 /* Now the Buddy label */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
921 label = gtk_label_new(NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
922 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Buddy:"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
923 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
924 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
925
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
926 /* Now the Buddy drop-down entry field. */
20028
a2b4eac83902 Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19980
diff changeset
927 info->entry = pidgin_text_combo_box_entry_new(NULL, generate_invite_user_names(gc));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
928 gtk_table_attach_defaults(GTK_TABLE(table), info->entry, 1, 2, 0, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
929 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
930
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
931 /* Now the label for "Message" */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
932 label = gtk_label_new(NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
933 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Message:"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
934 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
935 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
936
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
937
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
938 /* And finally, the Message entry field. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
939 info->message = gtk_entry_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
940 gtk_entry_set_activates_default(GTK_ENTRY(info->message), TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
941
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
942 gtk_table_attach_defaults(GTK_TABLE(table), info->message, 1, 2, 1, 2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
943 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->message);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
944
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
945 /* Connect the signals. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
946 g_signal_connect(G_OBJECT(invite_dialog), "response",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
947 G_CALLBACK(do_invite), info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
948 /* Setup drag-and-drop */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
949 gtk_drag_dest_set(info->window,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
950 GTK_DEST_DEFAULT_MOTION |
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
951 GTK_DEST_DEFAULT_DROP,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
952 dnd_targets,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
953 sizeof(dnd_targets) / sizeof(GtkTargetEntry),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
954 GDK_ACTION_COPY);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
955 gtk_drag_dest_set(info->entry,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
956 GTK_DEST_DEFAULT_MOTION |
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
957 GTK_DEST_DEFAULT_DROP,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
958 dnd_targets,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
959 sizeof(dnd_targets) / sizeof(GtkTargetEntry),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
960 GDK_ACTION_COPY);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
961
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
962 g_signal_connect(G_OBJECT(info->window), "drag_data_received",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
963 G_CALLBACK(invite_dnd_recv), info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
964 g_signal_connect(G_OBJECT(info->entry), "drag_data_received",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
965 G_CALLBACK(invite_dnd_recv), info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
966
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
967 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
968
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
969 gtk_widget_show_all(invite_dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
970
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
971 if (info != NULL)
20028
a2b4eac83902 Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19980
diff changeset
972 gtk_widget_grab_focus(GTK_BIN(info->entry)->child);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
973 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
974
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
975 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
976 menu_new_conv_cb(gpointer data, guint action, GtkWidget *widget)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
977 {
16202
0973688f4b74 Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@wiktel.com>
parents: 16193
diff changeset
978 pidgin_dialogs_im();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
979 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
980
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
981 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
982 savelog_writefile_cb(void *user_data, const char *filename)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
983 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
984 PurpleConversation *conv = (PurpleConversation *)user_data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
985 FILE *fp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
986 const char *name;
19665
37429bc82307 I think this fixes #2858.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19655
diff changeset
987 char **lines;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
988 gchar *text;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
989
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
990 if ((fp = g_fopen(filename, "w+")) == NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
991 purple_notify_error(PIDGIN_CONVERSATION(conv), NULL, _("Unable to open file."), NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
992 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
993 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
994
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
995 name = purple_conversation_get_name(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
996 fprintf(fp, "<html>\n<head><title>%s</title></head>\n<body>", name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
997 fprintf(fp, _("<h1>Conversation with %s</h1>\n"), name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
998
19665
37429bc82307 I think this fixes #2858.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19655
diff changeset
999 lines = gtk_imhtml_get_markup_lines(
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1000 GTK_IMHTML(PIDGIN_CONVERSATION(conv)->imhtml));
19667
a2f5a28ba983 More fix, thanks to SimGuy.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19665
diff changeset
1001 text = g_strjoinv("<br>\n", lines);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1002 fprintf(fp, "%s", text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1003 g_free(text);
19665
37429bc82307 I think this fixes #2858.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19655
diff changeset
1004 g_strfreev(lines);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1005
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1006 fprintf(fp, "\n</body>\n</html>\n");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1007 fclose(fp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1008 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1009
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1010 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1011 * It would be kinda cool if this gave the option of saving a
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1012 * plaintext v. HTML file.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1013 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1014 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1015 menu_save_as_cb(gpointer data, guint action, GtkWidget *widget)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1016 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1017 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1018 PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win);
17195
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1019 PurpleBuddy *buddy = purple_find_buddy(conv->account, conv->name);
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1020 const char *name;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1021 gchar *buf;
17195
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1022 gchar *c;
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1023
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1024 if (buddy != NULL)
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1025 name = purple_buddy_get_contact_alias(buddy);
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1026 else
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1027 name = purple_normalize(conv->account, conv->name);
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1028
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1029 buf = g_strdup_printf("%s.html", name);
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1030 for (c = buf ; *c ; c++)
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1031 {
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1032 if (*c == '/' || *c == '\\')
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1033 *c = ' ';
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1034 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1035 purple_request_file(PIDGIN_CONVERSATION(conv), _("Save Conversation"),
17195
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1036 buf,
16442
08db93bbd798 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 <evan.s@dreskin.net>
parents: 16437
diff changeset
1037 TRUE, G_CALLBACK(savelog_writefile_cb), NULL,
08db93bbd798 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 <evan.s@dreskin.net>
parents: 16437
diff changeset
1038 NULL, NULL, conv,
08db93bbd798 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 <evan.s@dreskin.net>
parents: 16437
diff changeset
1039 conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1040
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1041 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1042 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1043
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1044 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1045 menu_view_log_cb(gpointer data, guint action, GtkWidget *widget)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1046 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1047 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1048 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1049 PurpleLogType type;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1050 PidginBuddyList *gtkblist;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1051 GdkCursor *cursor;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1052 const char *name;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1053 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1054 GSList *buddies;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1055 GSList *cur;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1056
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1057 conv = pidgin_conv_window_get_active_conversation(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1058
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1059 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1060 type = PURPLE_LOG_IM;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1061 else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1062 type = PURPLE_LOG_CHAT;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1063 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1064 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1065
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1066 gtkblist = pidgin_blist_get_default_gtk_blist();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1067
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1068 cursor = gdk_cursor_new(GDK_WATCH);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1069 gdk_window_set_cursor(gtkblist->window->window, cursor);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1070 gdk_window_set_cursor(win->window->window, cursor);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1071 gdk_cursor_unref(cursor);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1072 #if GTK_CHECK_VERSION(2,4,0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1073 gdk_display_flush(gdk_drawable_get_display(GDK_DRAWABLE(widget->window)));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1074 #else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1075 gdk_flush();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1076 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1077
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1078 name = purple_conversation_get_name(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1079 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1080
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1081 buddies = purple_find_buddies(account, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1082 for (cur = buddies; cur != NULL; cur = cur->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1083 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1084 PurpleBlistNode *node = cur->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1085 if ((node != NULL) && ((node->prev != NULL) || (node->next != NULL)))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1086 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1087 pidgin_log_show_contact((PurpleContact *)node->parent);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1088 g_slist_free(buddies);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1089 gdk_window_set_cursor(gtkblist->window->window, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1090 gdk_window_set_cursor(win->window->window, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1091 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1092 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1093 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1094 g_slist_free(buddies);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1095
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1096 pidgin_log_show(type, name, account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1097
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1098 gdk_window_set_cursor(gtkblist->window->window, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1099 gdk_window_set_cursor(win->window->window, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1100 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1101
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1102 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1103 menu_clear_cb(gpointer data, guint action, GtkWidget *widget)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1104 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1105 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1106 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1107
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1108 conv = pidgin_conv_window_get_active_conversation(win);
20172
a112d292be7f Clear the conversation history for all the purple-convs in a pidgin-conv.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20103
diff changeset
1109 clear_conversation_scrollback(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1110 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1111
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1112 struct _search {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1113 PidginWindow *gtkwin;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1114 GtkWidget *entry;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1115 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1116
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1117 static void do_search_cb(GtkWidget *widget, gint resp, struct _search *s)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1118 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1119 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1120 PidginConversation *gtk_active_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1121 GList *iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1122
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1123 conv = pidgin_conv_window_get_active_conversation(s->gtkwin);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1124 gtk_active_conv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1125
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1126 switch (resp)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1127 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1128 case GTK_RESPONSE_OK:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1129 /* clear highlighting except the active conversation window
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1130 * highlight the keywords in the active conversation window */
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1131 for (iter = pidgin_conv_window_get_gtkconvs(s->gtkwin) ; iter ; iter = iter->next)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1132 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1133 PidginConversation *gtkconv = iter->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1134
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1135 if (gtkconv != gtk_active_conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1136 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1137 gtk_imhtml_search_clear(GTK_IMHTML(gtkconv->imhtml));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1138 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1139 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1140 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1141 gtk_imhtml_search_find(GTK_IMHTML(gtk_active_conv->imhtml),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1142 gtk_entry_get_text(GTK_ENTRY(s->entry)));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1143 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1144 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1145 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1146
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1147 case GTK_RESPONSE_DELETE_EVENT:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1148 case GTK_RESPONSE_CLOSE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1149 /* clear the keyword highlighting in all the conversation windows */
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1150 for (iter = pidgin_conv_window_get_gtkconvs(s->gtkwin); iter; iter=iter->next)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1151 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1152 PidginConversation *gconv = iter->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1153 gtk_imhtml_search_clear(GTK_IMHTML(gconv->imhtml));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1154 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1155
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1156 gtk_widget_destroy(s->gtkwin->dialogs.search);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1157 s->gtkwin->dialogs.search = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1158 g_free(s);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1159 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1160 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1161 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1162
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1163 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1164 menu_find_cb(gpointer data, guint action, GtkWidget *widget)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1165 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1166 PidginWindow *gtkwin = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1167 GtkWidget *hbox;
15436
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15435
diff changeset
1168 GtkWidget *img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_QUESTION,
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15435
diff changeset
1169 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_HUGE));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1170 GtkWidget *label;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1171 struct _search *s;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1172
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1173 if (gtkwin->dialogs.search) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1174 gtk_window_present(GTK_WINDOW(gtkwin->dialogs.search));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1175 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1176 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1177
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1178 s = g_malloc(sizeof(struct _search));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1179 s->gtkwin = gtkwin;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1180
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1181 gtkwin->dialogs.search = gtk_dialog_new_with_buttons(_("Find"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1182 GTK_WINDOW(gtkwin->window), GTK_DIALOG_DESTROY_WITH_PARENT,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1183 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1184 GTK_STOCK_FIND, GTK_RESPONSE_OK, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1185 gtk_dialog_set_default_response(GTK_DIALOG(gtkwin->dialogs.search),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1186 GTK_RESPONSE_OK);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1187 g_signal_connect(G_OBJECT(gtkwin->dialogs.search), "response",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1188 G_CALLBACK(do_search_cb), s);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1189
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
1190 gtk_container_set_border_width(GTK_CONTAINER(gtkwin->dialogs.search), PIDGIN_HIG_BOX_SPACE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1191 gtk_window_set_resizable(GTK_WINDOW(gtkwin->dialogs.search), FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1192 gtk_dialog_set_has_separator(GTK_DIALOG(gtkwin->dialogs.search), FALSE);
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
1193 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(gtkwin->dialogs.search)->vbox), PIDGIN_HIG_BORDER);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1194 gtk_container_set_border_width(
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
1195 GTK_CONTAINER(GTK_DIALOG(gtkwin->dialogs.search)->vbox), PIDGIN_HIG_BOX_SPACE);
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
1196
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
1197 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1198 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(gtkwin->dialogs.search)->vbox),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1199 hbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1200 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1201
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1202 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1203 gtk_dialog_set_response_sensitive(GTK_DIALOG(gtkwin->dialogs.search),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1204 GTK_RESPONSE_OK, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1205
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1206 label = gtk_label_new(NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1207 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Search for:"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1208 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1209
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1210 s->entry = gtk_entry_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1211 gtk_entry_set_activates_default(GTK_ENTRY(s->entry), TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1212 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(s->entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1213 g_signal_connect(G_OBJECT(s->entry), "changed",
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1214 G_CALLBACK(pidgin_set_sensitive_if_input),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1215 gtkwin->dialogs.search);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1216 gtk_box_pack_start(GTK_BOX(hbox), s->entry, FALSE, FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1217
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1218 gtk_widget_show_all(gtkwin->dialogs.search);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1219 gtk_widget_grab_focus(s->entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1220 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1221
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1222 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1223 menu_send_file_cb(gpointer data, guint action, GtkWidget *widget)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1224 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1225 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1226 PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1227
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1228 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1229 serv_send_file(purple_conversation_get_gc(conv), purple_conversation_get_name(conv), NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1230 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1231
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1232 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1233
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1234 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1235 menu_add_pounce_cb(gpointer data, guint action, GtkWidget *widget)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1236 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1237 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1238 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1239
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1240 conv = pidgin_conv_window_get_active_gtkconv(win)->active_conv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1241
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1242 pidgin_pounce_editor_show(purple_conversation_get_account(conv),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1243 purple_conversation_get_name(conv), NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1244 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1245
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1246 static void
17776
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1247 menu_insert_link_cb(gpointer data, guint action, GtkWidget *widget)
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1248 {
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1249 PidginWindow *win = data;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1250 PidginConversation *gtkconv;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1251 GtkIMHtmlToolbar *toolbar;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1252
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1253 gtkconv = pidgin_conv_window_get_active_gtkconv(win);
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1254 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar);
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1255
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1256 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->link),
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1257 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->link)));
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1258 }
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1259
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1260 static void
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1261 menu_insert_image_cb(gpointer data, guint action, GtkWidget *widget)
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1262 {
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1263 PidginWindow *win = data;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1264 PurpleConversation *conv;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1265 PidginConversation *gtkconv;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1266 GtkIMHtmlToolbar *toolbar;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1267
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1268 gtkconv = pidgin_conv_window_get_active_gtkconv(win);
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1269 conv = gtkconv->active_conv;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1270 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar);
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1271
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1272 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image),
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1273 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->image)));
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1274 }
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1275
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1276
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1277 static void
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1278 menu_alias_cb(gpointer data, guint action, GtkWidget *widget)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1279 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1280 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1281 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1282 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1283 const char *name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1284
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1285 conv = pidgin_conv_window_get_active_conversation(win);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1286 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1287 name = purple_conversation_get_name(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1288
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1289 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1290 PurpleBuddy *b;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1291
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1292 b = purple_find_buddy(account, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1293 if (b != NULL)
16202
0973688f4b74 Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@wiktel.com>
parents: 16193
diff changeset
1294 pidgin_dialogs_alias_buddy(b);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1295 } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1296 PurpleChat *c;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1297
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1298 c = purple_blist_find_chat(account, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1299 if (c != NULL)
16202
0973688f4b74 Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@wiktel.com>
parents: 16193
diff changeset
1300 pidgin_dialogs_alias_chat(c);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1301 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1302 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1303
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1304 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1305 menu_get_info_cb(gpointer data, guint action, GtkWidget *widget)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1306 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1307 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1308 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1309
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1310 conv = pidgin_conv_window_get_active_conversation(win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1311
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1312 info_cb(NULL, PIDGIN_CONVERSATION(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1313 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1314
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1315 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1316 menu_invite_cb(gpointer data, guint action, GtkWidget *widget)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1317 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1318 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1319 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1320
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1321 conv = pidgin_conv_window_get_active_conversation(win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1322
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1323 invite_cb(NULL, PIDGIN_CONVERSATION(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1324 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1325
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1326 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1327 menu_block_cb(gpointer data, guint action, GtkWidget *widget)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1328 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1329 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1330 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1331
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1332 conv = pidgin_conv_window_get_active_conversation(win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1333
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1334 block_cb(NULL, PIDGIN_CONVERSATION(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1335 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1336
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1337 static void
15426
c9497aad9fc4 Warmenhoved patch #1397916: "Turns Block button in conv menu into Unblock after blocking" from Glauber de Oliveira Costa (glommer). You know the drill.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15374
diff changeset
1338 menu_unblock_cb(gpointer data, guint action, GtkWidget *widget)
c9497aad9fc4 Warmenhoved patch #1397916: "Turns Block button in conv menu into Unblock after blocking" from Glauber de Oliveira Costa (glommer). You know the drill.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15374
diff changeset
1339 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1340 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1341 PurpleConversation *conv;
15426
c9497aad9fc4 Warmenhoved patch #1397916: "Turns Block button in conv menu into Unblock after blocking" from Glauber de Oliveira Costa (glommer). You know the drill.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15374
diff changeset
1342
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1343 conv = pidgin_conv_window_get_active_conversation(win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1344
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1345 unblock_cb(NULL, PIDGIN_CONVERSATION(conv));
15426
c9497aad9fc4 Warmenhoved patch #1397916: "Turns Block button in conv menu into Unblock after blocking" from Glauber de Oliveira Costa (glommer). You know the drill.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15374
diff changeset
1346 }
c9497aad9fc4 Warmenhoved patch #1397916: "Turns Block button in conv menu into Unblock after blocking" from Glauber de Oliveira Costa (glommer). You know the drill.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15374
diff changeset
1347
c9497aad9fc4 Warmenhoved patch #1397916: "Turns Block button in conv menu into Unblock after blocking" from Glauber de Oliveira Costa (glommer). You know the drill.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15374
diff changeset
1348 static void
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1349 menu_add_remove_cb(gpointer data, guint action, GtkWidget *widget)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1350 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1351 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1352 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1353
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1354 conv = pidgin_conv_window_get_active_conversation(win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1355
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1356 add_remove_cb(NULL, PIDGIN_CONVERSATION(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1357 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1358
19900
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1359 static gboolean
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1360 close_already(gpointer data)
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1361 {
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1362 purple_conversation_destroy(data);
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1363 return FALSE;
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1364 }
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1365
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1366 static void
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1367 hide_conv(PidginConversation *gtkconv, gboolean closetimer)
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1368 {
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1369 GList *list;
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1370
19556
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
1371 purple_signal_emit(pidgin_conversations_get_handle(),
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
1372 "conversation-hiding", gtkconv);
19900
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1373
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1374 for (list = g_list_copy(gtkconv->convs); list; list = g_list_delete_link(list, list)) {
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1375 PurpleConversation *conv = list->data;
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1376 if (closetimer) {
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1377 guint timer = GPOINTER_TO_INT(purple_conversation_get_data(conv, "close-timer"));
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1378 if (timer)
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1379 purple_timeout_remove(timer);
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1380 timer = purple_timeout_add_seconds(CLOSE_CONV_TIMEOUT_SECS, close_already, conv);
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1381 purple_conversation_set_data(conv, "close-timer", GINT_TO_POINTER(timer));
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1382 }
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
1383 #if 0
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
1384 /* I will miss you */
19900
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1385 purple_conversation_set_ui_ops(conv, NULL);
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
1386 #else
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
1387 pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv);
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
1388 pidgin_conv_window_add_gtkconv(hidden_convwin, gtkconv);
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
1389 #endif
19900
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1390 }
19423
dc4e8460622f Add a 'Hide' item under 'Conversation' menu so people can check this thing out.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19422
diff changeset
1391 }
dc4e8460622f Add a 'Hide' item under 'Conversation' menu so people can check this thing out.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19422
diff changeset
1392
dc4e8460622f Add a 'Hide' item under 'Conversation' menu so people can check this thing out.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19422
diff changeset
1393 static void
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1394 menu_close_conv_cb(gpointer data, guint action, GtkWidget *widget)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1395 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1396 PidginWindow *win = data;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1397
18797
0622a7f08dde smaller close buttons on tabs. I think this looks really good.
Sean Egan <seanegan@gmail.com>
parents: 18796
diff changeset
1398 close_conv_cb(NULL, NULL, PIDGIN_CONVERSATION(pidgin_conv_window_get_active_conversation(win)));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1399 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1400
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1401 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1402 menu_logging_cb(gpointer data, guint action, GtkWidget *widget)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1403 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1404 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1405 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1406 gboolean logging;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1407
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1408 conv = pidgin_conv_window_get_active_conversation(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1409
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1410 if (conv == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1411 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1412
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1413 logging = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1414
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1415 if (logging == purple_conversation_is_logging(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1416 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1417
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1418 if (logging)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1419 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1420 /* Enable logging first so the message below can be logged. */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1421 purple_conversation_set_logging(conv, TRUE);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1422
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1423 purple_conversation_write(conv, NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1424 _("Logging started. Future messages in this conversation will be logged."),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1425 conv->logs ? (PURPLE_MESSAGE_SYSTEM) :
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1426 (PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1427 time(NULL));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1428 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1429 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1430 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1431 purple_conversation_write(conv, NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1432 _("Logging stopped. Future messages in this conversation will not be logged."),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1433 conv->logs ? (PURPLE_MESSAGE_SYSTEM) :
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1434 (PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1435 time(NULL));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1436
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1437 /* Disable the logging second, so that the above message can be logged. */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1438 purple_conversation_set_logging(conv, FALSE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1439 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1440 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1441
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1442 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1443 menu_toolbar_cb(gpointer data, guint action, GtkWidget *widget)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1444 {
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
1445 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1446 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1447 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1448
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1449 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1450 menu_sounds_cb(gpointer data, guint action, GtkWidget *widget)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1451 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1452 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1453 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1454 PidginConversation *gtkconv;
19980
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
1455 PurpleBlistNode *node;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1456
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1457 conv = pidgin_conv_window_get_active_conversation(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1458
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1459 if (!conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1460 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1461
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1462 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1463
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1464 gtkconv->make_sound =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1465 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
19980
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
1466 node = get_conversation_blist_node(conv);
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
1467 if (node)
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
1468 purple_blist_node_set_bool(node, "gtk-mute-sound", !gtkconv->make_sound);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1469 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1470
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1471 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1472 menu_timestamps_cb(gpointer data, guint action, GtkWidget *widget)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1473 {
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
1474 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/show_timestamps",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1475 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1476 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1477
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1478 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1479 chat_do_im(PidginConversation *gtkconv, const char *who)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1480 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1481 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1482 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1483 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1484 PurplePluginProtocolInfo *prpl_info = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1485 char *real_who;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1486
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1487 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1488 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1489
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1490 gc = purple_account_get_connection(account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1491 g_return_if_fail(gc != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1492
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1493 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1494
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1495 if (prpl_info && prpl_info->get_cb_real_name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1496 real_who = prpl_info->get_cb_real_name(gc,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1497 purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), who);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1498 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1499 real_who = g_strdup(who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1500
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1501 if(!real_who)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1502 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1503
16202
0973688f4b74 Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@wiktel.com>
parents: 16193
diff changeset
1504 pidgin_dialogs_im_with_user(account, real_who);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1505
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1506 g_free(real_who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1507 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1508
16286
3974d12a56ec Fix ignore in chats when using right-click on a nick in the conversation
Stu Tomlinson <stu@nosnilmot.com>
parents: 16273
diff changeset
1509 static void pidgin_conv_chat_update_user(PurpleConversation *conv, const char *user);
3974d12a56ec Fix ignore in chats when using right-click on a nick in the conversation
Stu Tomlinson <stu@nosnilmot.com>
parents: 16273
diff changeset
1510
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1511 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1512 ignore_cb(GtkWidget *w, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1513 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1514 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1515 PurpleConvChat *chat;
16286
3974d12a56ec Fix ignore in chats when using right-click on a nick in the conversation
Stu Tomlinson <stu@nosnilmot.com>
parents: 16273
diff changeset
1516 const char *name;
3974d12a56ec Fix ignore in chats when using right-click on a nick in the conversation
Stu Tomlinson <stu@nosnilmot.com>
parents: 16273
diff changeset
1517
3974d12a56ec Fix ignore in chats when using right-click on a nick in the conversation
Stu Tomlinson <stu@nosnilmot.com>
parents: 16273
diff changeset
1518 chat = PURPLE_CONV_CHAT(conv);
3974d12a56ec Fix ignore in chats when using right-click on a nick in the conversation
Stu Tomlinson <stu@nosnilmot.com>
parents: 16273
diff changeset
1519 name = g_object_get_data(G_OBJECT(w), "user_data");
3974d12a56ec Fix ignore in chats when using right-click on a nick in the conversation
Stu Tomlinson <stu@nosnilmot.com>
parents: 16273
diff changeset
1520
3974d12a56ec Fix ignore in chats when using right-click on a nick in the conversation
Stu Tomlinson <stu@nosnilmot.com>
parents: 16273
diff changeset
1521 if (name == NULL)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1522 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1523
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1524 if (purple_conv_chat_is_user_ignored(chat, name))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1525 purple_conv_chat_unignore(chat, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1526 else
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1527 purple_conv_chat_ignore(chat, name);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1528
16286
3974d12a56ec Fix ignore in chats when using right-click on a nick in the conversation
Stu Tomlinson <stu@nosnilmot.com>
parents: 16273
diff changeset
1529 pidgin_conv_chat_update_user(conv, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1530 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1531
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1532 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1533 menu_chat_im_cb(GtkWidget *w, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1534 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1535 const char *who = g_object_get_data(G_OBJECT(w), "user_data");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1536
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1537 chat_do_im(gtkconv, who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1538 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1539
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1540 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1541 menu_chat_send_file_cb(GtkWidget *w, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1542 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1543 PurpleConversation *conv = gtkconv->active_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1544 const char *who = g_object_get_data(G_OBJECT(w), "user_data");
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1545 PurpleConnection *gc = purple_conversation_get_gc(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1546
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1547 serv_send_file(gc, who, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1548 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1549
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1550 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1551 menu_chat_info_cb(GtkWidget *w, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1552 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1553 char *who;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1554
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1555 who = g_object_get_data(G_OBJECT(w), "user_data");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1556
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1557 chat_do_info(gtkconv, who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1558 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1559
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1560 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1561 menu_chat_get_away_cb(GtkWidget *w, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1562 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1563 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1564 PurplePluginProtocolInfo *prpl_info = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1565 PurpleConnection *gc;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1566 char *who;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1567
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1568 gc = purple_conversation_get_gc(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1569 who = g_object_get_data(G_OBJECT(w), "user_data");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1570
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1571 if (gc != NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1572 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1573
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1574 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1575 * May want to expand this to work similarly to menu_info_cb?
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1576 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1577
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1578 if (prpl_info->get_cb_away != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1579 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1580 prpl_info->get_cb_away(gc,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1581 purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), who);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1582 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1583 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1584 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1585
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1586 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1587 menu_chat_add_remove_cb(GtkWidget *w, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1588 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1589 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1590 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1591 PurpleBuddy *b;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1592 char *name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1593
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1594 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1595 name = g_object_get_data(G_OBJECT(w), "user_data");
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1596 b = purple_find_buddy(account, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1597
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1598 if (b != NULL)
16202
0973688f4b74 Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@wiktel.com>
parents: 16193
diff changeset
1599 pidgin_dialogs_remove_buddy(b);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1600 else if (account != NULL && purple_account_is_connected(account))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1601 purple_blist_request_add_buddy(account, name, NULL, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1602
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1603 gtk_widget_grab_focus(PIDGIN_CONVERSATION(conv)->entry);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1604 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1605
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1606 static GtkTextMark *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1607 get_mark_for_user(PidginConversation *gtkconv, const char *who)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1608 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1609 GtkTextBuffer *buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1610 char *tmp = g_strconcat("user:", who, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1611 GtkTextMark *mark = gtk_text_buffer_get_mark(buf, tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1612
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1613 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1614 return mark;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1615 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1616
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1617 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1618 menu_last_said_cb(GtkWidget *w, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1619 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1620 GtkTextMark *mark;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1621 const char *who;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1622
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1623 who = g_object_get_data(G_OBJECT(w), "user_data");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1624 mark = get_mark_for_user(gtkconv, who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1625
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1626 if (mark != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1627 gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(gtkconv->imhtml), mark, 0.1, FALSE, 0, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1628 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1629 g_return_if_reached();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1630 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1631
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1632 static GtkWidget *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1633 create_chat_menu(PurpleConversation *conv, const char *who, PurpleConnection *gc)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1634 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1635 static GtkWidget *menu = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1636 PurplePluginProtocolInfo *prpl_info = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1637 PurpleConvChat *chat = PURPLE_CONV_CHAT(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1638 gboolean is_me = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1639 GtkWidget *button;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1640 PurpleBuddy *buddy = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1641
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1642 if (gc != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1643 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1644
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1645 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1646 * If a menu already exists, destroy it before creating a new one,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1647 * thus freeing-up the memory it occupied.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1648 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1649 if (menu)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1650 gtk_widget_destroy(menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1651
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1652 if (!strcmp(chat->nick, purple_normalize(conv->account, who)))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1653 is_me = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1654
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1655 menu = gtk_menu_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1656
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1657 if (!is_me) {
15560
442128853bdb toolbar/menu icons. reduce the imhtmltoolbar spacing. more gaimstock pruning
Sean Egan <seanegan@gmail.com>
parents: 15557
diff changeset
1658 button = pidgin_new_item_from_stock(menu, _("IM"), PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW,
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1659 G_CALLBACK(menu_chat_im_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1660
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1661 if (gc == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1662 gtk_widget_set_sensitive(button, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1663
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1664 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1665
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1666
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1667 if (prpl_info && prpl_info->send_file)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1668 {
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
1669 button = pidgin_new_item_from_stock(menu, _("Send File"),
16839
d6ccf170148e New Send File icon
Hylke Bons <hylkebons@gmail.com>
parents: 16809
diff changeset
1670 PIDGIN_STOCK_TOOLBAR_SEND_FILE, G_CALLBACK(menu_chat_send_file_cb),
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1671 PIDGIN_CONVERSATION(conv), 0, 0, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1672
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1673 if (gc == NULL || prpl_info == NULL ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1674 !(!prpl_info->can_receive_file || prpl_info->can_receive_file(gc, who)))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1675 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1676 gtk_widget_set_sensitive(button, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1677 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1678
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1679 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1680 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1681
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1682
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1683 if (purple_conv_chat_is_user_ignored(PURPLE_CONV_CHAT(conv), who))
15509
23ca11f8a8c4 stock to pidgin
Sean Egan <seanegan@gmail.com>
parents: 15508
diff changeset
1684 button = pidgin_new_item_from_stock(menu, _("Un-Ignore"), PIDGIN_STOCK_IGNORE,
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1685 G_CALLBACK(ignore_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1686 else
15509
23ca11f8a8c4 stock to pidgin
Sean Egan <seanegan@gmail.com>
parents: 15508
diff changeset
1687 button = pidgin_new_item_from_stock(menu, _("Ignore"), PIDGIN_STOCK_IGNORE,
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1688 G_CALLBACK(ignore_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1689
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1690 if (gc == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1691 gtk_widget_set_sensitive(button, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1692
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1693 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1694 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1695
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1696 if (prpl_info && (prpl_info->get_info || prpl_info->get_cb_info)) {
15560
442128853bdb toolbar/menu icons. reduce the imhtmltoolbar spacing. more gaimstock pruning
Sean Egan <seanegan@gmail.com>
parents: 15557
diff changeset
1697 button = pidgin_new_item_from_stock(menu, _("Info"), PIDGIN_STOCK_TOOLBAR_USER_INFO,
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1698 G_CALLBACK(menu_chat_info_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1699
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1700 if (gc == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1701 gtk_widget_set_sensitive(button, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1702
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1703 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1704 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1705
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1706 if (prpl_info && prpl_info->get_cb_away) {
15509
23ca11f8a8c4 stock to pidgin
Sean Egan <seanegan@gmail.com>
parents: 15508
diff changeset
1707 button = pidgin_new_item_from_stock(menu, _("Get Away Message"), PIDGIN_STOCK_AWAY,
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1708 G_CALLBACK(menu_chat_get_away_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1709
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1710 if (gc == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1711 gtk_widget_set_sensitive(button, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1712
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1713 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1714 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1715
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1716 if (!is_me && prpl_info && !(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1717 if ((buddy = purple_find_buddy(conv->account, who)) != NULL)
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
1718 button = pidgin_new_item_from_stock(menu, _("Remove"), GTK_STOCK_REMOVE,
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1719 G_CALLBACK(menu_chat_add_remove_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1720 else
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
1721 button = pidgin_new_item_from_stock(menu, _("Add"), GTK_STOCK_ADD,
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1722 G_CALLBACK(menu_chat_add_remove_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1723
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1724 if (gc == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1725 gtk_widget_set_sensitive(button, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1726
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1727 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1728 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1729
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
1730 button = pidgin_new_item_from_stock(menu, _("Last said"), GTK_STOCK_INDEX,
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1731 G_CALLBACK(menu_last_said_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1732 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1733 if (!get_mark_for_user(PIDGIN_CONVERSATION(conv), who))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1734 gtk_widget_set_sensitive(button, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1735
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1736 if (buddy != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1737 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1738 if (purple_account_is_connected(conv->account))
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1739 pidgin_append_blist_node_proto_menu(menu, conv->account->gc,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1740 (PurpleBlistNode *)buddy);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1741 pidgin_append_blist_node_extended_menu(menu, (PurpleBlistNode *)buddy);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1742 gtk_widget_show_all(menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1743 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1744
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1745 return menu;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1746 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1747
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1748
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1749 static gint
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1750 gtkconv_chat_popup_menu_cb(GtkWidget *widget, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1751 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1752 PurpleConversation *conv = gtkconv->active_conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1753 PidginChatPane *gtkchat;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1754 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1755 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1756 GtkTreeSelection *sel;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1757 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1758 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1759 GtkWidget *menu;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1760 gchar *who;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1761
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1762 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1763 gtkchat = gtkconv->u.chat;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1764 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1765 gc = account->gc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1766
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1767 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1768
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1769 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1770 if(!gtk_tree_selection_get_selected(sel, NULL, &iter))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1771 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1772
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1773 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &who, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1774 menu = create_chat_menu (conv, who, gc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1775 gtk_menu_popup(GTK_MENU(menu), NULL, NULL,
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1776 pidgin_treeview_popup_menu_position_func, widget,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1777 0, GDK_CURRENT_TIME);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1778 g_free(who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1779
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1780 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1781 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1782
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1783
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1784 static gint
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1785 right_click_chat_cb(GtkWidget *widget, GdkEventButton *event,
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1786 PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1787 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1788 PurpleConversation *conv = gtkconv->active_conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1789 PidginChatPane *gtkchat;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1790 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1791 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1792 GtkTreePath *path;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1793 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1794 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1795 GtkTreeViewColumn *column;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1796 gchar *who;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1797 int x, y;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1798
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1799 gtkchat = gtkconv->u.chat;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1800 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1801 gc = account->gc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1802
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1803 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1804
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1805 gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(gtkchat->list),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1806 event->x, event->y, &path, &column, &x, &y);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1807
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1808 if (path == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1809 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1810
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1811 gtk_tree_selection_select_path(GTK_TREE_SELECTION(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1812 gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list))), path);
18311
6fa1bbf6b0a9 Allow the userlist to get focus, to allow keyboard navigation of it.
Sean Egan <seanegan@gmail.com>
parents: 18306
diff changeset
1813 gtk_tree_view_set_cursor(GTK_TREE_VIEW(gtkchat->list),
6fa1bbf6b0a9 Allow the userlist to get focus, to allow keyboard navigation of it.
Sean Egan <seanegan@gmail.com>
parents: 18306
diff changeset
1814 path, NULL, FALSE);
6fa1bbf6b0a9 Allow the userlist to get focus, to allow keyboard navigation of it.
Sean Egan <seanegan@gmail.com>
parents: 18306
diff changeset
1815 gtk_widget_grab_focus(GTK_WIDGET(gtkchat->list));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1816
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1817 gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, path);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1818 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &who, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1819
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1820 if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1821 chat_do_im(gtkconv, who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1822 } else if (event->button == 2 && event->type == GDK_BUTTON_PRESS) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1823 /* Move to user's anchor */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1824 GtkTextMark *mark = get_mark_for_user(gtkconv, who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1825
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1826 if(mark != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1827 gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(gtkconv->imhtml), mark, 0.1, FALSE, 0, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1828 } else if (event->button == 3 && event->type == GDK_BUTTON_PRESS) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1829 GtkWidget *menu = create_chat_menu (conv, who, gc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1830 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1831 event->button, event->time);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1832 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1833
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1834 g_free(who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1835 gtk_tree_path_free(path);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1836
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1837 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1838 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1839
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1840 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1841 move_to_next_unread_tab(PidginConversation *gtkconv, gboolean forward)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1842 {
17141
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1843 PidginConversation *next_gtkconv = NULL, *most_active = NULL;
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1844 PidginUnseenState unseen_state = PIDGIN_UNSEEN_NONE;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1845 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1846 int initial, i, total, diff;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1847
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1848 win = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1849 initial = gtk_notebook_page_num(GTK_NOTEBOOK(win->notebook),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1850 gtkconv->tab_cont);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1851 total = pidgin_conv_window_get_gtkconv_count(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1852 /* By adding total here, the moduli calculated later will always have two
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1853 * positive arguments. x % y where x < 0 is not guaranteed to return a
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1854 * positive number.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1855 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1856 diff = (forward ? 1 : -1) + total;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1857
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1858 for (i = (initial + diff) % total; i != initial; i = (i + diff) % total) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1859 next_gtkconv = pidgin_conv_window_get_gtkconv_at_index(win, i);
17141
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1860 if (next_gtkconv->unseen_state > unseen_state) {
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1861 most_active = next_gtkconv;
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1862 unseen_state = most_active->unseen_state;
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1863 if(PIDGIN_UNSEEN_NICK == unseen_state) /* highest possible state */
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1864 break;
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1865 }
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1866 }
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1867
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1868 if (most_active == NULL) { /* no new messages */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1869 i = (i + diff) % total;
17141
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1870 most_active = pidgin_conv_window_get_gtkconv_at_index(win, i);
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1871 }
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1872
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1873 if (most_active != NULL && most_active != gtkconv)
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1874 pidgin_conv_window_switch_gtkconv(win, most_active);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1875 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1876
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1877 static gboolean
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1878 conv_keypress_common(PidginConversation *gtkconv, GdkEventKey *event)
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1879 {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1880 PidginWindow *win;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1881 PurpleConversation *conv;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1882 int curconv;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1883
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1884 conv = gtkconv->active_conv;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1885 win = gtkconv->win;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1886 curconv = gtk_notebook_get_current_page(GTK_NOTEBOOK(win->notebook));
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1887
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1888 /* If CTRL was held down... */
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1889 if (event->state & GDK_CONTROL_MASK) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1890 switch (event->keyval) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1891 case GDK_Page_Down:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1892 case ']':
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1893 if (!pidgin_conv_window_get_gtkconv_at_index(win, curconv + 1))
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1894 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), 0);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1895 else
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1896 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), curconv + 1);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1897 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1898 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1899
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1900 case GDK_Page_Up:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1901 case '[':
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1902 if (!pidgin_conv_window_get_gtkconv_at_index(win, curconv - 1))
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1903 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), -1);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1904 else
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1905 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), curconv - 1);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1906 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1907 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1908
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1909 case GDK_Tab:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1910 case GDK_ISO_Left_Tab:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1911 if (event->state & GDK_SHIFT_MASK) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1912 move_to_next_unread_tab(gtkconv, FALSE);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1913 } else {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1914 move_to_next_unread_tab(gtkconv, TRUE);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1915 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1916
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1917 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1918 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1919
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1920 case GDK_comma:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1921 gtk_notebook_reorder_child(GTK_NOTEBOOK(win->notebook),
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1922 gtk_notebook_get_nth_page(GTK_NOTEBOOK(win->notebook), curconv),
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1923 curconv - 1);
20190
da6a1320d3e1 applied changes from f4700a52b60d8473e9671ceabfec7772211fe424
Richard Laager <rlaager@wiktel.com>
parents: 20183
diff changeset
1924 return TRUE;
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1925 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1926
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1927 case GDK_period:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1928 gtk_notebook_reorder_child(GTK_NOTEBOOK(win->notebook),
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1929 gtk_notebook_get_nth_page(GTK_NOTEBOOK(win->notebook), curconv),
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1930 #if GTK_CHECK_VERSION(2,2,0)
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1931 (curconv + 1) % gtk_notebook_get_n_pages(GTK_NOTEBOOK(win->notebook)));
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1932 #else
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1933 (curconv + 1) % g_list_length(GTK_NOTEBOOK(win->notebook)->children));
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1934 #endif
20190
da6a1320d3e1 applied changes from f4700a52b60d8473e9671ceabfec7772211fe424
Richard Laager <rlaager@wiktel.com>
parents: 20183
diff changeset
1935 return TRUE;
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1936 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1937
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1938 } /* End of switch */
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1939 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1940
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1941 /* If ALT (or whatever) was held down... */
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1942 else if (event->state & GDK_MOD1_MASK)
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1943 {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1944 if (event->keyval > '0' && event->keyval <= '9')
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1945 {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1946 guint switchto = event->keyval - '1';
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1947 if (switchto < pidgin_conv_window_get_gtkconv_count(win))
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1948 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), switchto);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1949
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1950 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1951 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1952 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1953
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1954 /* If neither CTRL nor ALT were held down... */
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1955 else
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1956 {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1957 switch (event->keyval) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1958 case GDK_F2:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1959 if (gtk_widget_is_focus(GTK_WIDGET(win->notebook))) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1960 infopane_entry_activate(gtkconv);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1961 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1962 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1963 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1964 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1965 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1966 return FALSE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1967 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1968
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1969 static gboolean
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1970 entry_key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1971 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1972 PidginWindow *win;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1973 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1974 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1975
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1976 gtkconv = (PidginConversation *)data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1977 conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1978 win = gtkconv->win;
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1979
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1980 if (conv_keypress_common(gtkconv, event))
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1981 return TRUE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1982
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1983 /* If CTRL was held down... */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1984 if (event->state & GDK_CONTROL_MASK) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1985 switch (event->keyval) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1986 case GDK_Up:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1987 if (!gtkconv->send_history)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1988 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1989
17820
192a86dfade8 Handle key presses in the topic entry area in chats so Alt-# etc. works for
Stu Tomlinson <stu@nosnilmot.com>
parents: 17776
diff changeset
1990 if (gtkconv->entry != entry)
192a86dfade8 Handle key presses in the topic entry area in chats so Alt-# etc. works for
Stu Tomlinson <stu@nosnilmot.com>
parents: 17776
diff changeset
1991 break;
192a86dfade8 Handle key presses in the topic entry area in chats so Alt-# etc. works for
Stu Tomlinson <stu@nosnilmot.com>
parents: 17776
diff changeset
1992
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1993 if (!gtkconv->send_history->prev) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1994 GtkTextIter start, end;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1995
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1996 g_free(gtkconv->send_history->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1997
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1998 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1999 &start);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2000 gtk_text_buffer_get_end_iter(gtkconv->entry_buffer, &end);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2001
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2002 gtkconv->send_history->data =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2003 gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2004 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2005
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2006 if (gtkconv->send_history->next && gtkconv->send_history->next->data) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2007 GObject *object;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2008 GtkTextIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2009 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2010
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2011 gtkconv->send_history = gtkconv->send_history->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2012
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2013 /* Block the signal to prevent application of default formatting. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2014 object = g_object_ref(G_OBJECT(gtkconv->entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2015 g_signal_handlers_block_matched(object, G_SIGNAL_MATCH_DATA, 0, 0, NULL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2016 NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2017 /* Clear the formatting. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2018 gtk_imhtml_clear_formatting(GTK_IMHTML(gtkconv->entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2019 /* Unblock the signal. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2020 g_signal_handlers_unblock_matched(object, G_SIGNAL_MATCH_DATA, 0, 0, NULL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2021 NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2022 g_object_unref(object);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2023
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2024 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2025 gtk_imhtml_append_text_with_images(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2026 GTK_IMHTML(gtkconv->entry), gtkconv->send_history->data,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2027 0, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2028 /* this is mainly just a hack so the formatting at the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2029 * cursor gets picked up. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2030 gtk_text_buffer_get_end_iter(buffer, &iter);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2031 gtk_text_buffer_move_mark_by_name(buffer, "insert", &iter);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2032 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2033
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2034 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2035 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2036
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2037 case GDK_Down:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2038 if (!gtkconv->send_history)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2039 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2040
17820
192a86dfade8 Handle key presses in the topic entry area in chats so Alt-# etc. works for
Stu Tomlinson <stu@nosnilmot.com>
parents: 17776
diff changeset
2041 if (gtkconv->entry != entry)
192a86dfade8 Handle key presses in the topic entry area in chats so Alt-# etc. works for
Stu Tomlinson <stu@nosnilmot.com>
parents: 17776
diff changeset
2042 break;
192a86dfade8 Handle key presses in the topic entry area in chats so Alt-# etc. works for
Stu Tomlinson <stu@nosnilmot.com>
parents: 17776
diff changeset
2043
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2044 if (gtkconv->send_history->prev && gtkconv->send_history->prev->data) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2045 GObject *object;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2046 GtkTextIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2047 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2048
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2049 gtkconv->send_history = gtkconv->send_history->prev;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2050
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2051 /* Block the signal to prevent application of default formatting. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2052 object = g_object_ref(G_OBJECT(gtkconv->entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2053 g_signal_handlers_block_matched(object, G_SIGNAL_MATCH_DATA, 0, 0, NULL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2054 NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2055 /* Clear the formatting. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2056 gtk_imhtml_clear_formatting(GTK_IMHTML(gtkconv->entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2057 /* Unblock the signal. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2058 g_signal_handlers_unblock_matched(object, G_SIGNAL_MATCH_DATA, 0, 0, NULL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2059 NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2060 g_object_unref(object);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2061
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2062 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2063 gtk_imhtml_append_text_with_images(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2064 GTK_IMHTML(gtkconv->entry), gtkconv->send_history->data,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2065 0, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2066 /* this is mainly just a hack so the formatting at the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2067 * cursor gets picked up. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2068 if (*(char *)gtkconv->send_history->data) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2069 gtk_text_buffer_get_end_iter(buffer, &iter);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2070 gtk_text_buffer_move_mark_by_name(buffer, "insert", &iter);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2071 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2072 /* Restore the default formatting */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2073 default_formatize(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2074 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2075 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2076
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2077 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2078 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2079 } /* End of switch */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2080 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2081
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2082 /* If ALT (or whatever) was held down... */
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2083 else if (event->state & GDK_MOD1_MASK) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2084
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2085 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2086
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2087 /* If neither CTRL nor ALT were held down... */
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2088 else {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2089 switch (event->keyval) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2090 case GDK_Tab:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2091 if (gtkconv->entry != entry)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2092 break;
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2093 return tab_complete(conv);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2094 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2095
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2096 case GDK_Page_Up:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2097 gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml));
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2098 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2099 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2100
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2101 case GDK_Page_Down:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2102 gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml));
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2103 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2104 break;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2105
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2106 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2107 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2108 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2109 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2110
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2111 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2112 * NOTE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2113 * This guy just kills a single right click from being propagated any
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2114 * further. I have no idea *why* we need this, but we do ... It
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2115 * prevents right clicks on the GtkTextView in a convo dialog from
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2116 * going all the way down to the notebook. I suspect a bug in
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2117 * GtkTextView, but I'm not ready to point any fingers yet.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2118 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2119 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2120 entry_stop_rclick_cb(GtkWidget *widget, GdkEventButton *event, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2121 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2122 if (event->button == 3 && event->type == GDK_BUTTON_PRESS) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2123 /* Right single click */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2124 g_signal_stop_emission_by_name(G_OBJECT(widget), "button_press_event");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2125
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2126 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2127 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2128
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2129 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2130 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2131
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2132 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2133 * If someone tries to type into the conversation backlog of a
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2134 * conversation window then we yank focus from the conversation backlog
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2135 * and give it to the text entry box so that people can type
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2136 * all the live long day and it will get entered into the entry box.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2137 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2138 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2139 refocus_entry_cb(GtkWidget *widget, GdkEventKey *event, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2140 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2141 PidginConversation *gtkconv = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2142
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2143 /* If we have a valid key for the conversation display, then exit */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2144 if ((event->state & GDK_CONTROL_MASK) ||
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2145 (event->keyval == GDK_F6) ||
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2146 (event->keyval == GDK_F10) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2147 (event->keyval == GDK_Shift_L) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2148 (event->keyval == GDK_Shift_R) ||
16315
ee4ce3c4186f Fix #248 (Control shouldn't steal focus from scrollback)
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16286
diff changeset
2149 (event->keyval == GDK_Control_L) ||
ee4ce3c4186f Fix #248 (Control shouldn't steal focus from scrollback)
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16286
diff changeset
2150 (event->keyval == GDK_Control_R) ||
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2151 (event->keyval == GDK_Escape) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2152 (event->keyval == GDK_Up) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2153 (event->keyval == GDK_Down) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2154 (event->keyval == GDK_Left) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2155 (event->keyval == GDK_Right) ||
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2156 (event->keyval == GDK_Page_Up) ||
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2157 (event->keyval == GDK_Page_Down) ||
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2158 (event->keyval == GDK_Home) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2159 (event->keyval == GDK_End) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2160 (event->keyval == GDK_Tab) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2161 (event->keyval == GDK_ISO_Left_Tab))
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2162 {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2163 if (event->type == GDK_KEY_PRESS)
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2164 return conv_keypress_common(gtkconv, event);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2165 return FALSE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2166 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2167
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2168 if (event->type == GDK_KEY_RELEASE)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2169 gtk_widget_grab_focus(gtkconv->entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2170
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2171 gtk_widget_event(gtkconv->entry, (GdkEvent *)event);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2172
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2173 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2174 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2175
17846
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
2176 static void
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
2177 regenerate_options_items(PidginWindow *win);
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
2178
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2179 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2180 pidgin_conv_switch_active_conversation(PurpleConversation *conv)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2181 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2182 PidginConversation *gtkconv;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2183 PurpleConversation *old_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2184 GtkIMHtml *entry;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2185 const char *protocol_name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2186
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2187 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2188
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2189 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2190 old_conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2191
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2192 if (old_conv == conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2193 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2194
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2195 purple_conversation_close_logs(old_conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2196 gtkconv->active_conv = conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2197
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2198 purple_conversation_set_logging(conv,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2199 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(gtkconv->win->menu.logging)));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2200
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2201 entry = GTK_IMHTML(gtkconv->entry);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2202 protocol_name = purple_account_get_protocol_name(conv->account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2203 gtk_imhtml_set_protocol_name(entry, protocol_name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2204 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), protocol_name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2205
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2206 if (!(conv->features & PURPLE_CONNECTION_HTML))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2207 gtk_imhtml_clear_formatting(GTK_IMHTML(gtkconv->entry));
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2208 else if (conv->features & PURPLE_CONNECTION_FORMATTING_WBFO &&
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2209 !(old_conv->features & PURPLE_CONNECTION_FORMATTING_WBFO))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2210 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2211 /* The old conversation allowed formatting on parts of the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2212 * buffer, but the new one only allows it on the whole
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2213 * buffer. This code saves the formatting from the current
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2214 * position of the cursor, clears the formatting, then
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2215 * applies the saved formatting to the entire buffer. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2216
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2217 gboolean bold;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2218 gboolean italic;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2219 gboolean underline;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2220 char *fontface = gtk_imhtml_get_current_fontface(entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2221 char *forecolor = gtk_imhtml_get_current_forecolor(entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2222 char *backcolor = gtk_imhtml_get_current_backcolor(entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2223 char *background = gtk_imhtml_get_current_background(entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2224 gint fontsize = gtk_imhtml_get_current_fontsize(entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2225 gboolean bold2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2226 gboolean italic2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2227 gboolean underline2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2228
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2229 gtk_imhtml_get_current_format(entry, &bold, &italic, &underline);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2230
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2231 /* Clear existing formatting */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2232 gtk_imhtml_clear_formatting(entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2233
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2234 /* Apply saved formatting to the whole buffer. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2235
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2236 gtk_imhtml_get_current_format(entry, &bold2, &italic2, &underline2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2237
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2238 if (bold != bold2)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2239 gtk_imhtml_toggle_bold(entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2240
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2241 if (italic != italic2)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2242 gtk_imhtml_toggle_italic(entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2243
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2244 if (underline != underline2)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2245 gtk_imhtml_toggle_underline(entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2246
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2247 gtk_imhtml_toggle_fontface(entry, fontface);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2248
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2249 if (!(conv->features & PURPLE_CONNECTION_NO_FONTSIZE))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2250 gtk_imhtml_font_set_size(entry, fontsize);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2251
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2252 gtk_imhtml_toggle_forecolor(entry, forecolor);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2253
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2254 if (!(conv->features & PURPLE_CONNECTION_NO_BGCOLOR))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2255 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2256 gtk_imhtml_toggle_backcolor(entry, backcolor);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2257 gtk_imhtml_toggle_background(entry, background);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2258 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2259
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2260 g_free(fontface);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2261 g_free(forecolor);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2262 g_free(backcolor);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2263 g_free(background);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2264 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2265 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2266 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2267 /* This is done in default_formatize, which is called from clear_formatting_cb,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2268 * which is (obviously) a clear_formatting signal handler. However, if we're
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2269 * here, we didn't call gtk_imhtml_clear_formatting() (because we want to
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2270 * preserve the formatting exactly as it is), so we have to do this now. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2271 gtk_imhtml_set_whole_buffer_formatting_only(entry,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2272 (conv->features & PURPLE_CONNECTION_FORMATTING_WBFO));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2273 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2274
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2275 purple_signal_emit(pidgin_conversations_get_handle(), "conversation-switched", conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2276
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2277 gray_stuff_out(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2278 update_typing_icon(gtkconv);
17846
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
2279 g_object_set_data(G_OBJECT(entry), "transient_buddy", NULL);
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
2280 regenerate_options_items(gtkconv->win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2281
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2282 gtk_window_set_title(GTK_WINDOW(gtkconv->win->window),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2283 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label)));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2284 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2285
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2286 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2287 menu_conv_sel_send_cb(GObject *m, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2288 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2289 PurpleAccount *account = g_object_get_data(m, "purple_account");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2290 gchar *name = g_object_get_data(m, "purple_buddy_name");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2291 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2292
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2293 if (gtk_check_menu_item_get_active((GtkCheckMenuItem*) m) == FALSE)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2294 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2295
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2296 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, name);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
2297 pidgin_conv_switch_active_conversation(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2298 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2299
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2300 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2301 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2302 gchar *new_text, gint new_text_length, gpointer user_data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2303 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2304 PidginConversation *gtkconv = (PidginConversation *)user_data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2305 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2306
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2307 g_return_if_fail(gtkconv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2308
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2309 conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2310
16427
4999bbc52881 Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents: 16358
diff changeset
2311 if (!purple_prefs_get_bool("/purple/conversations/im/send_typing"))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2312 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2313
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2314 got_typing_keypress(gtkconv, (gtk_text_iter_is_start(position) &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2315 gtk_text_iter_is_end(position)));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2316 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2317
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2318 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2319 delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2320 GtkTextIter *end_pos, gpointer user_data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2321 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2322 PidginConversation *gtkconv = (PidginConversation *)user_data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2323 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2324 PurpleConvIm *im;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2325
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2326 g_return_if_fail(gtkconv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2327
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2328 conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2329
16427
4999bbc52881 Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents: 16358
diff changeset
2330 if (!purple_prefs_get_bool("/purple/conversations/im/send_typing"))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2331 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2332
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2333 im = PURPLE_CONV_IM(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2334
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2335 if (gtk_text_iter_is_start(start_pos) && gtk_text_iter_is_end(end_pos)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2336
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2337 /* We deleted all the text, so turn off typing. */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2338 purple_conv_im_stop_send_typed_timeout(im);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2339
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2340 serv_send_typing(purple_conversation_get_gc(conv),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2341 purple_conversation_get_name(conv),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2342 PURPLE_NOT_TYPING);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2343 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2344 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2345 /* We're deleting, but not all of it, so it counts as typing. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2346 got_typing_keypress(gtkconv, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2347 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2348 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2349
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2350 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2351 * A bunch of buddy icon functions
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2352 **************************************************************************/
15724
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2353
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2354 static GList *get_prpl_icon_list(PurpleAccount *account)
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2355 {
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2356 GList *l = NULL;
17397
012aaa301a30 Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17392
diff changeset
2357 PurplePlugin *prpl = purple_find_prpl(purple_account_get_protocol_id(account));
012aaa301a30 Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17392
diff changeset
2358 PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
012aaa301a30 Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17392
diff changeset
2359 const char *prplname = prpl_info->list_icon(account, NULL);
012aaa301a30 Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17392
diff changeset
2360 l = g_hash_table_lookup(prpl_lists, prplname);
15724
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2361 if (l)
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2362 return l;
17397
012aaa301a30 Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17392
diff changeset
2363
012aaa301a30 Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17392
diff changeset
2364 l = g_list_prepend(l, pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_LARGE));
012aaa301a30 Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17392
diff changeset
2365 l = g_list_prepend(l, pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_MEDIUM));
012aaa301a30 Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17392
diff changeset
2366 l = g_list_prepend(l, pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_SMALL));
012aaa301a30 Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17392
diff changeset
2367
012aaa301a30 Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17392
diff changeset
2368 g_hash_table_insert(prpl_lists, g_strdup(prplname), l);
15724
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2369 return l;
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2370 }
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2371
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2372 static GList *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2373 pidgin_conv_get_tab_icons(PurpleConversation *conv)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2374 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2375 PurpleAccount *account = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2376 const char *name = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2377
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2378 g_return_val_if_fail(conv != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2379
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2380 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2381 name = purple_conversation_get_name(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2382
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2383 g_return_val_if_fail(account != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2384 g_return_val_if_fail(name != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2385
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2386 /* Use the buddy icon, if possible */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2387 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2388 PurpleBuddy *b = purple_find_buddy(account, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2389 if (b != NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2390 PurplePresence *p;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2391 p = purple_buddy_get_presence(b);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2392 if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_AWAY))
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2393 return away_list;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2394 if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_UNAVAILABLE))
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2395 return busy_list;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2396 if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_EXTENDED_AWAY))
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2397 return xa_list;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2398 if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_OFFLINE))
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2399 return offline_list;
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2400 else
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2401 return available_list;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2402 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2403 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2404
15724
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2405 return get_prpl_icon_list(account);
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2406 }
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2407
19899
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2408 static GdkPixbuf *
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2409 pidgin_conv_get_icon(PurpleConversation *conv, GtkWidget *parent, const char *icon_size)
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2410 {
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2411 PurpleAccount *account = NULL;
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2412 const char *name = NULL;
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2413 GdkPixbuf *status = NULL;
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2414 PurpleBlistUiOps *ops = purple_blist_get_ui_ops();
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2415 g_return_val_if_fail(conv != NULL, NULL);
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2416
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2417 account = purple_conversation_get_account(conv);
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2418 name = purple_conversation_get_name(conv);
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2419
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2420 g_return_val_if_fail(account != NULL, NULL);
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2421 g_return_val_if_fail(name != NULL, NULL);
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2422
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2423 /* Use the buddy icon, if possible */
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2424 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) {
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2425 PurpleBuddy *b = purple_find_buddy(account, name);
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2426 if (b != NULL) {
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2427 PurplePresence *p = purple_buddy_get_presence(b);
19899
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2428 /* I hate this hack. It fixes a bug where the pending message icon
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2429 * displays in the conv tab even though it shouldn't.
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2430 * A better solution would be great. */
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2431 if (ops && ops->update)
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2432 ops->update(NULL, (PurpleBlistNode*)b);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2433
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2434 /* XXX Seanegan: We really need a util function to return a pixbuf for a Presence to avoid all this switching */
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2435 if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_AWAY))
19899
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2436 status = pidgin_create_status_icon(PURPLE_STATUS_AWAY, parent, icon_size);
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2437 else if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_EXTENDED_AWAY))
19899
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2438 status = pidgin_create_status_icon(PURPLE_STATUS_EXTENDED_AWAY, parent, icon_size);
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2439 else if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_OFFLINE))
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2440 status = pidgin_create_status_icon(PURPLE_STATUS_OFFLINE, parent, icon_size);
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2441 else if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_AVAILABLE))
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2442 status = pidgin_create_status_icon(PURPLE_STATUS_AVAILABLE, parent, icon_size);
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2443 else if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_INVISIBLE))
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2444 status = pidgin_create_status_icon(PURPLE_STATUS_INVISIBLE, parent, icon_size);
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2445 else if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_UNAVAILABLE))
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2446 status = pidgin_create_status_icon(PURPLE_STATUS_UNAVAILABLE, parent, icon_size);
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2447 }
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2448 }
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2449
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2450 /* If they don't have a buddy icon, then use the PRPL icon */
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2451 if (status == NULL) {
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2452 GtkIconSize size = gtk_icon_size_from_name(icon_size);
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2453 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) {
19899
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2454 status = gtk_widget_render_icon (parent, PIDGIN_STOCK_STATUS_PERSON,
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2455 size, "GtkWidget");
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2456 } else {
19899
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2457 status = gtk_widget_render_icon (parent, PIDGIN_STOCK_STATUS_CHAT,
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2458 size, "GtkWidget");
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2459 }
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2460 }
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2461 return status;
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2462 }
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2463
19899
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2464 GdkPixbuf *
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2465 pidgin_conv_get_tab_icon(PurpleConversation *conv, gboolean small_icon)
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2466 {
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2467 const char *icon_size = small_icon ? PIDGIN_ICON_SIZE_TANGO_MICROSCOPIC : PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL;
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2468 return pidgin_conv_get_icon(conv, PIDGIN_CONVERSATION(conv)->icon, icon_size);
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2469 }
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2470
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2471
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2472 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2473 update_tab_icon(PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2474 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2475 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2476 PidginWindow *win;
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2477 PurpleBuddy *b;
16315
ee4ce3c4186f Fix #248 (Control shouldn't steal focus from scrollback)
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16286
diff changeset
2478 GList *l;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2479 GdkPixbuf *status = NULL;
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2480 GdkPixbuf *infopane_status = NULL;
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2481 GdkPixbuf *emblem = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2482
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2483 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2484
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2485 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2486 win = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2487 if (conv != gtkconv->active_conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2488 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2489
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2490
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
2491 status = pidgin_conv_get_tab_icon(conv, TRUE);
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2492 infopane_status = pidgin_conv_get_tab_icon(conv, FALSE);
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2493
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2494 b = purple_find_buddy(conv->account, conv->name);
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2495 if (b)
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2496 emblem = pidgin_blist_get_emblem((PurpleBlistNode*)b);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2497
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2498 g_return_if_fail(status != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2499
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2500 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon), status);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2501 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->menu_icon), status);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2502
18214
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2503 gtk_list_store_set(GTK_LIST_STORE(gtkconv->infopane_model),
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2504 &(gtkconv->infopane_iter),
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2505 CONV_ICON_COLUMN, infopane_status, -1);
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2506
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2507 gtk_list_store_set(GTK_LIST_STORE(gtkconv->infopane_model),
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2508 &(gtkconv->infopane_iter),
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2509 CONV_EMBLEM_COLUMN, emblem, -1);
20834
6b9e5bbab0fe We need to unref the pixmaps after adding them to a list store.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20796
diff changeset
2510 if (emblem)
6b9e5bbab0fe We need to unref the pixmaps after adding them to a list store.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20796
diff changeset
2511 g_object_unref(emblem);
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2512
19474
74befdcd0454 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@gmail.com>
parents: 19468
diff changeset
2513 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons")) {
20834
6b9e5bbab0fe We need to unref the pixmaps after adding them to a list store.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20796
diff changeset
2514 emblem = pidgin_create_prpl_icon(gtkconv->active_conv->account, PIDGIN_PRPL_ICON_SMALL);
19474
74befdcd0454 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@gmail.com>
parents: 19468
diff changeset
2515 gtk_list_store_set(GTK_LIST_STORE(gtkconv->infopane_model),
74befdcd0454 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@gmail.com>
parents: 19468
diff changeset
2516 &(gtkconv->infopane_iter),
20834
6b9e5bbab0fe We need to unref the pixmaps after adding them to a list store.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20796
diff changeset
2517 CONV_PROTOCOL_ICON_COLUMN, emblem, -1);
6b9e5bbab0fe We need to unref the pixmaps after adding them to a list store.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20796
diff changeset
2518 if (emblem)
6b9e5bbab0fe We need to unref the pixmaps after adding them to a list store.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20796
diff changeset
2519 g_object_unref(emblem);
19474
74befdcd0454 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@gmail.com>
parents: 19468
diff changeset
2520 }
74befdcd0454 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@gmail.com>
parents: 19468
diff changeset
2521
18649
8f36a83bc1cf Redraw infopane after setting icons. I'm not sure why I need to do this. I'll look into it later. Fixes #1892
Sean Egan <seanegan@gmail.com>
parents: 18632
diff changeset
2522 /* XXX seanegan Why do I have to do this? */
8f36a83bc1cf Redraw infopane after setting icons. I'm not sure why I need to do this. I'll look into it later. Fixes #1892
Sean Egan <seanegan@gmail.com>
parents: 18632
diff changeset
2523 gtk_widget_queue_draw(gtkconv->infopane);
18181
a8c701d877aa Start work on blist pane in conversation. Looks like: http://pidgin.im/~seanegan/infopane.png Certainly much to be done yet.
Sean Egan <seanegan@gmail.com>
parents: 18167
diff changeset
2524
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2525 if (status != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2526 g_object_unref(status);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2527
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2528 if (pidgin_conv_window_is_active_conversation(conv) &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2529 (purple_conversation_get_type(conv) != PURPLE_CONV_TYPE_IM ||
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2530 gtkconv->u.im->anim == NULL))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2531 {
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2532 l = pidgin_conv_get_tab_icons(conv);
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2533
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2534 gtk_window_set_icon_list(GTK_WINDOW(win->window), l);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2535 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2536 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2537
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2538 /* This gets added as an idle handler when doing something that
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2539 * redraws the icon. It sets the auto_resize gboolean to TRUE.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2540 * This way, when the size_allocate callback gets triggered, it notices
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2541 * that this is an autoresize, and after the main loop iterates, it
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2542 * gets set back to FALSE
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2543 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2544 static gboolean reset_auto_resize_cb(gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2545 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2546 PidginConversation *gtkconv = (PidginConversation *)data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2547 gtkconv->auto_resize = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2548 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2549 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2550
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2551 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2552 redraw_icon(gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2553 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2554 PidginConversation *gtkconv = (PidginConversation *)data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2555 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2556 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2557 PurplePluginProtocolInfo *prpl_info = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2558
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2559 GdkPixbuf *buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2560 GdkPixbuf *scale;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2561 gint delay;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2562 int scale_width, scale_height;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2563
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2564 gtkconv = PIDGIN_CONVERSATION(conv);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2565 account = purple_conversation_get_account(conv);
16604
598b66923c81 hopefully fix 236
Nathan Walp <nwalp@pidgin.im>
parents: 16577
diff changeset
2566
598b66923c81 hopefully fix 236
Nathan Walp <nwalp@pidgin.im>
parents: 16577
diff changeset
2567 if(account && account->gc) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2568 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(account->gc->prpl);
16604
598b66923c81 hopefully fix 236
Nathan Walp <nwalp@pidgin.im>
parents: 16577
diff changeset
2569 } else {
598b66923c81 hopefully fix 236
Nathan Walp <nwalp@pidgin.im>
parents: 16577
diff changeset
2570 gtkconv->u.im->icon_timer = 0;
598b66923c81 hopefully fix 236
Nathan Walp <nwalp@pidgin.im>
parents: 16577
diff changeset
2571 return FALSE;
598b66923c81 hopefully fix 236
Nathan Walp <nwalp@pidgin.im>
parents: 16577
diff changeset
2572 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2573
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2574 gdk_pixbuf_animation_iter_advance(gtkconv->u.im->iter, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2575 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2576
18214
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2577 scale_width = gdk_pixbuf_get_width(buf);
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2578 scale_height = gdk_pixbuf_get_height(buf);
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2579 if (scale_width == scale_height) {
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2580 scale_width = scale_height = 32;
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2581 } else if (scale_height > scale_width) {
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2582 scale_width = 32 * scale_width / scale_height;
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2583 scale_height = 32;
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2584 } else {
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2585 scale_height = 32 * scale_height / scale_width;
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2586 scale_width = 32;
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2587 }
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2588
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2589 scale = gdk_pixbuf_scale_simple(buf, scale_width, scale_height,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2590 GDK_INTERP_BILINEAR);
18212
77b9ceb83426 Rounds icons in the infopane. Since gdk_pixbuf_animation_get_static_image seems to return pixbufs without alpha channels, this only rounds animated icons that aren't transparent.
Sean Egan <seanegan@gmail.com>
parents: 18211
diff changeset
2591 if (pidgin_gdk_pixbuf_is_opaque(scale))
77b9ceb83426 Rounds icons in the infopane. Since gdk_pixbuf_animation_get_static_image seems to return pixbufs without alpha channels, this only rounds animated icons that aren't transparent.
Sean Egan <seanegan@gmail.com>
parents: 18211
diff changeset
2592 pidgin_gdk_pixbuf_make_round(scale);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2593
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2594 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->u.im->icon), scale);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2595 g_object_unref(G_OBJECT(scale));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2596 gtk_widget_queue_draw(gtkconv->u.im->icon);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2597
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2598 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2599
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2600 if (delay < 100)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2601 delay = 100;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2602
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2603 gtkconv->u.im->icon_timer = g_timeout_add(delay, redraw_icon, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2604
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2605 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2606 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2607
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2608 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2609 start_anim(GtkObject *obj, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2610 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2611 int delay;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2612
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2613 if (gtkconv->u.im->anim == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2614 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2615
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2616 if (gtkconv->u.im->icon_timer != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2617 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2618
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2619 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2620 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2621
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2622 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2623
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2624 if (delay < 100)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2625 delay = 100;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2626
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2627 gtkconv->u.im->icon_timer = g_timeout_add(delay, redraw_icon, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2628 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2629
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2630 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2631 remove_icon(GtkWidget *widget, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2632 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2633 PurpleConversation *conv = gtkconv->active_conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2634 PidginWindow *gtkwin;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2635
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2636 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2637
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2638 if (gtkconv->u.im->icon_container != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2639 gtk_widget_destroy(gtkconv->u.im->icon_container);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2640
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2641 if (gtkconv->u.im->anim != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2642 g_object_unref(G_OBJECT(gtkconv->u.im->anim));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2643
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2644 if (gtkconv->u.im->icon_timer != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2645 g_source_remove(gtkconv->u.im->icon_timer);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2646
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2647 if (gtkconv->u.im->iter != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2648 g_object_unref(G_OBJECT(gtkconv->u.im->iter));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2649
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2650 gtkconv->u.im->icon_timer = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2651 gtkconv->u.im->icon = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2652 gtkconv->u.im->anim = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2653 gtkconv->u.im->iter = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2654 gtkconv->u.im->icon_container = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2655 gtkconv->u.im->show_icon = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2656
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2657 gtkwin = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2658 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2659
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2660 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2661 saveicon_writefile_cb(void *user_data, const char *filename)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2662 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2663 PidginConversation *gtkconv = (PidginConversation *)user_data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2664 PurpleConversation *conv = gtkconv->active_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2665 FILE *fp;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2666 PurpleBuddyIcon *icon;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2667 const void *data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2668 size_t len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2669
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2670 if ((fp = g_fopen(filename, "wb")) == NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2671 purple_notify_error(gtkconv, NULL, _("Unable to open file."), NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2672 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2673 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2674
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2675 icon = purple_conv_im_get_icon(PURPLE_CONV_IM(conv));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2676 data = purple_buddy_icon_get_data(icon, &len);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2677
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2678 if ((len <= 0) || (data == NULL) || (fwrite(data, 1, len, fp) != len)) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2679 purple_notify_error(gtkconv, NULL, _("Unable to save icon file to disk."), NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2680 fclose(fp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2681 g_unlink(filename);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2682 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2683 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2684 fclose(fp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2685 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2686
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2687 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2688 custom_icon_sel_cb(const char *filename, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2689 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2690 if (filename) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2691 PidginConversation *gtkconv = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2692 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2693 PurpleAccount *account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2694 pidgin_set_custom_buddy_icon(account, purple_conversation_get_name(conv), filename);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2695 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2696 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2697
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2698 static void
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2699 set_custom_icon_cb(GtkWidget *widget, PidginConversation *gtkconv)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2700 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2701 GtkWidget *win = pidgin_buddy_icon_chooser_new(GTK_WINDOW(gtkconv->win->window),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2702 custom_icon_sel_cb, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2703 gtk_widget_show_all(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2704 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2705
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2706 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2707 remove_custom_icon_cb(GtkWidget *widget, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2708 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2709 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2710 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2711
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2712 conv = gtkconv->active_conv;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2713 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2714 pidgin_set_custom_buddy_icon(account, purple_conversation_get_name(conv), NULL);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2715 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2716
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2717 static void
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2718 icon_menu_save_cb(GtkWidget *widget, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2719 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2720 PurpleConversation *conv = gtkconv->active_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2721 const gchar *ext;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2722 gchar *buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2723
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2724 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2725
16375
391a79778f89 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@wiktel.com>
parents: 16373
diff changeset
2726 ext = purple_buddy_icon_get_extension(purple_conv_im_get_icon(PURPLE_CONV_IM(conv)));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2727
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2728 buf = g_strdup_printf("%s.%s", purple_normalize(conv->account, conv->name), ext);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2729
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2730 purple_request_file(gtkconv, _("Save Icon"), buf, TRUE,
16442
08db93bbd798 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 <evan.s@dreskin.net>
parents: 16437
diff changeset
2731 G_CALLBACK(saveicon_writefile_cb), NULL,
08db93bbd798 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 <evan.s@dreskin.net>
parents: 16437
diff changeset
2732 conv->account, NULL, conv,
08db93bbd798 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 <evan.s@dreskin.net>
parents: 16437
diff changeset
2733 gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2734
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2735 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2736 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2737
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2738 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2739 stop_anim(GtkObject *obj, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2740 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2741 if (gtkconv->u.im->icon_timer != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2742 g_source_remove(gtkconv->u.im->icon_timer);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2743
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2744 gtkconv->u.im->icon_timer = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2745 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2746
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2747
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2748 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2749 toggle_icon_animate_cb(GtkWidget *w, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2750 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2751 gtkconv->u.im->animate =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2752 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2753
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2754 if (gtkconv->u.im->animate)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2755 start_anim(NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2756 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2757 stop_anim(NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2758 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2759
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2760 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2761 icon_menu(GtkObject *obj, GdkEventButton *e, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2762 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2763 static GtkWidget *menu = NULL;
16381
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
2764 PurpleConversation *conv;
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
2765 PurpleBuddy *buddy;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2766
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2767 if (e->button != 3 || e->type != GDK_BUTTON_PRESS)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2768 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2769
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2770 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2771 * If a menu already exists, destroy it before creating a new one,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2772 * thus freeing-up the memory it occupied.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2773 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2774 if (menu != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2775 gtk_widget_destroy(menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2776
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2777 menu = gtk_menu_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2778
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2779 if (gtkconv->u.im->anim &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2780 !(gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2781 {
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
2782 pidgin_new_check_item(menu, _("Animate"),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2783 G_CALLBACK(toggle_icon_animate_cb), gtkconv,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2784 gtkconv->u.im->icon_timer);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2785 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2786
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
2787 pidgin_new_item_from_stock(menu, _("Hide Icon"), NULL, G_CALLBACK(remove_icon),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2788 gtkconv, 0, 0, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2789
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
2790 pidgin_new_item_from_stock(menu, _("Save Icon As..."), GTK_STOCK_SAVE_AS,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2791 G_CALLBACK(icon_menu_save_cb), gtkconv,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2792 0, 0, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2793
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
2794 pidgin_new_item_from_stock(menu, _("Set Custom Icon..."), NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2795 G_CALLBACK(set_custom_icon_cb), gtkconv,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2796 0, 0, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2797
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2798 /* Is there a custom icon for this person? */
16381
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
2799 conv = gtkconv->active_conv;
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
2800 buddy = purple_find_buddy(purple_conversation_get_account(conv),
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
2801 purple_conversation_get_name(conv));
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
2802 if (buddy)
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
2803 {
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
2804 PurpleContact *contact = purple_buddy_get_contact(buddy);
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
2805 if (contact && purple_buddy_icons_has_custom_icon(contact))
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
2806 {
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
2807 pidgin_new_item_from_stock(menu, _("Remove Custom Icon"), NULL,
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
2808 G_CALLBACK(remove_custom_icon_cb), gtkconv,
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
2809 0, 0, NULL);
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
2810 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2811 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2812
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2813 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, e->button, e->time);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2814
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2815 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2816 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2817
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2818 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2819 * End of the bunch of buddy icon functions
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2820 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2821 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2822 pidgin_conv_present_conversation(PurpleConversation *conv)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2823 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2824 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
19417
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
2825 GdkModifierType state;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2826
19898
be8bb6f98c01 Get rid of hidden_convwin.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
2827 if (gtkconv == NULL) {
be8bb6f98c01 Get rid of hidden_convwin.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
2828 pidgin_conv_attach_to_conversation(conv);
be8bb6f98c01 Get rid of hidden_convwin.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
2829 gtkconv = PIDGIN_CONVERSATION(conv);
21702
cf579f61b887 merge of '2dee17b0fb69284b66649d32e66b473471970a43'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21701 19905
diff changeset
2830 } else if (gtkconv->win == hidden_convwin) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2831 pidgin_conv_window_remove_gtkconv(hidden_convwin, gtkconv);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
2832 pidgin_conv_placement_place(gtkconv);
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
2833 }
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
2834
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
2835 pidgin_conv_switch_active_conversation(conv);
19417
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
2836 /* Switch the tab only if the user initiated the event by pressing
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
2837 * a button or hitting a key. */
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
2838 if (gtk_get_current_event_state(&state))
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
2839 pidgin_conv_window_switch_gtkconv(gtkconv->win, gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2840 gtk_window_present(GTK_WINDOW(gtkconv->win->window));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2841 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2842
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2843 GList *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2844 pidgin_conversations_find_unseen_list(PurpleConversationType type,
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
2845 PidginUnseenState min_state,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2846 gboolean hidden_only,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2847 guint max_count)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2848 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
2849 GList *l;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2850 GList *r = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2851 guint c = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2852
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2853 if (type == PURPLE_CONV_TYPE_IM) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2854 l = purple_get_ims();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2855 } else if (type == PURPLE_CONV_TYPE_CHAT) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2856 l = purple_get_chats();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2857 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2858 l = purple_get_conversations();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2859 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2860
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2861 for (; l != NULL && (max_count == 0 || c < max_count); l = l->next) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2862 PurpleConversation *conv = (PurpleConversation*)l->data;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2863 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2864
19417
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
2865 if(gtkconv == NULL || gtkconv->active_conv != conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2866 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2867
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2868 if (gtkconv->unseen_state >= min_state
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2869 && (!hidden_only ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2870 (hidden_only && gtkconv->win == hidden_convwin))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2871
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2872 r = g_list_prepend(r, conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2873 c++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2874 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2875 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2876
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2877 return r;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2878 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2879
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2880 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2881 unseen_conv_menu_cb(GtkMenuItem *item, PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2882 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2883 g_return_if_fail(conv != NULL);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
2884 pidgin_conv_present_conversation(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2885 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2886
19584
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2887 static void
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2888 unseen_all_conv_menu_cb(GtkMenuItem *item, GList *list)
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2889 {
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2890 g_return_if_fail(list != NULL);
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2891 /* Do not free the list from here. It will be freed from the
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2892 * 'destroy' callback on the menuitem. */
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2893 while (list) {
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2894 pidgin_conv_present_conversation(list->data);
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2895 list = list->next;
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2896 }
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2897 }
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2898
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2899 guint
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2900 pidgin_conversations_fill_menu(GtkWidget *menu, GList *convs)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2901 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2902 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2903 guint ret=0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2904
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2905 g_return_val_if_fail(menu != NULL, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2906 g_return_val_if_fail(convs != NULL, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2907
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2908 for (l = convs; l != NULL ; l = l->next) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2909 PurpleConversation *conv = (PurpleConversation*)l->data;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2910 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2911
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2912 GtkWidget *icon = gtk_image_new();
19899
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2913 GdkPixbuf *pbuf = pidgin_conv_get_icon(conv, icon, PIDGIN_ICON_SIZE_TANGO_MICROSCOPIC);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2914 GtkWidget *item;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2915 gchar *text = g_strdup_printf("%s (%d)",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2916 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label)),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2917 gtkconv->unseen_count);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2918
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2919 gtk_image_set_from_pixbuf(GTK_IMAGE(icon), pbuf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2920 g_object_unref(pbuf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2921
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2922 item = gtk_image_menu_item_new_with_label(text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2923 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), icon);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2924 g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(unseen_conv_menu_cb), conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2925 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2926 g_free(text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2927 ret++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2928 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2929
19584
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2930 if (convs->next) {
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2931 /* There are more than one conversation. Add an option to show all conversations. */
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2932 GtkWidget *item;
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2933 GList *list = g_list_copy(convs);
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2934
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2935 pidgin_separator(menu);
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2936
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2937 item = gtk_menu_item_new_with_label(_("Show All"));
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2938 g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(unseen_all_conv_menu_cb), list);
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2939 g_signal_connect_swapped(G_OBJECT(item), "destroy", G_CALLBACK(g_list_free), list);
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2940 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2941 }
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2942
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2943 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2944 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2945
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2946 PidginWindow *
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
2947 pidgin_conv_get_window(PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2948 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2949 g_return_val_if_fail(gtkconv != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2950 return gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2951 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2952
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2953 static GtkItemFactoryEntry menu_items[] =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2954 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2955 /* Conversation menu */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2956 { N_("/_Conversation"), NULL, NULL, 0, "<Branch>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2957
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2958 { N_("/Conversation/New Instant _Message..."), "<CTL>M", menu_new_conv_cb,
15560
442128853bdb toolbar/menu icons. reduce the imhtmltoolbar spacing. more gaimstock pruning
Sean Egan <seanegan@gmail.com>
parents: 15557
diff changeset
2959 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW },
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2960
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2961 { "/Conversation/sep0", NULL, NULL, 0, "<Separator>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2962
25467
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 16358
diff changeset
2963 #if ENABLE_SHORTCUT
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2964 { N_("/Conversation/_Find..."), NULL, menu_find_cb, 0,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2965 "<StockItem>", GTK_STOCK_FIND },
25467
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 16358
diff changeset
2966 #else
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 16358
diff changeset
2967 { N_("/Conversation/_Find..."), NULL, menu_find_cb, 0,
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 16358
diff changeset
2968 "<Item>" },
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 16358
diff changeset
2969 #endif
15553
29a03d2d2395 Remove excess menu item icon clutter, especialy where our icons made no sense. The Redo icon for Buddy Pounces?! Come on.
Sean Egan <seanegan@gmail.com>
parents: 15542
diff changeset
2970 { N_("/Conversation/View _Log"), NULL, menu_view_log_cb, 0, "<Item>", NULL },
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2971 { N_("/Conversation/_Save As..."), NULL, menu_save_as_cb, 0,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2972 "<StockItem>", GTK_STOCK_SAVE_AS },
25467
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 16358
diff changeset
2973 #if ENABLE_SHORTCUT
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2974 { N_("/Conversation/Clea_r Scrollback"), "<CTL>L", menu_clear_cb, 0, "<StockItem>", GTK_STOCK_CLEAR },
25467
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 16358
diff changeset
2975 #else
25474
3b014d70e7c9 disable ctrl-l
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 25471
diff changeset
2976 { N_("/Conversation/Clea_r Scrollback"), NULL, menu_clear_cb, 0, "<Item>" },
25467
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 16358
diff changeset
2977 #endif
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2978 { "/Conversation/sep1", NULL, NULL, 0, "<Separator>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2979
16839
d6ccf170148e New Send File icon
Hylke Bons <hylkebons@gmail.com>
parents: 16809
diff changeset
2980 { N_("/Conversation/Se_nd File..."), NULL, menu_send_file_cb, 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_SEND_FILE },
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2981 { N_("/Conversation/Add Buddy _Pounce..."), NULL, menu_add_pounce_cb,
15553
29a03d2d2395 Remove excess menu item icon clutter, especialy where our icons made no sense. The Redo icon for Buddy Pounces?! Come on.
Sean Egan <seanegan@gmail.com>
parents: 15542
diff changeset
2982 0, "<Item>", NULL },
25467
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 16358
diff changeset
2983 #if ENABLE_SHORTCUT
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2984 { N_("/Conversation/_Get Info"), "<CTL>O", menu_get_info_cb, 0,
15560
442128853bdb toolbar/menu icons. reduce the imhtmltoolbar spacing. more gaimstock pruning
Sean Egan <seanegan@gmail.com>
parents: 15557
diff changeset
2985 "<StockItem>", PIDGIN_STOCK_TOOLBAR_USER_INFO },
25467
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 16358
diff changeset
2986 #else
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 16358
diff changeset
2987 { N_("/Conversation/_Get Info"), NULL, menu_get_info_cb, 0,
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 16358
diff changeset
2988 "<StockItem>", PIDGIN_STOCK_TOOLBAR_USER_INFO },
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 16358
diff changeset
2989 #endif
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2990 { N_("/Conversation/In_vite..."), NULL, menu_invite_cb, 0,
15553
29a03d2d2395 Remove excess menu item icon clutter, especialy where our icons made no sense. The Redo icon for Buddy Pounces?! Come on.
Sean Egan <seanegan@gmail.com>
parents: 15542
diff changeset
2991 "<Item>", NULL },
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2992 { N_("/Conversation/M_ore"), NULL, NULL, 0, "<Branch>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2993
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2994 { "/Conversation/sep2", NULL, NULL, 0, "<Separator>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2995
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2996 { N_("/Conversation/Al_ias..."), NULL, menu_alias_cb, 0,
15553
29a03d2d2395 Remove excess menu item icon clutter, especialy where our icons made no sense. The Redo icon for Buddy Pounces?! Come on.
Sean Egan <seanegan@gmail.com>
parents: 15542
diff changeset
2997 "<Item>", NULL },
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2998 { N_("/Conversation/_Block..."), NULL, menu_block_cb, 0,
16007
d64602bb59d2 block and unblock have the right icons now
Nathan Walp <nwalp@pidgin.im>
parents: 15990
diff changeset
2999 "<StockItem>", PIDGIN_STOCK_TOOLBAR_BLOCK },
15426
c9497aad9fc4 Warmenhoved patch #1397916: "Turns Block button in conv menu into Unblock after blocking" from Glauber de Oliveira Costa (glommer). You know the drill.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15374
diff changeset
3000 { N_("/Conversation/_Unblock..."), NULL, menu_unblock_cb, 0,
16007
d64602bb59d2 block and unblock have the right icons now
Nathan Walp <nwalp@pidgin.im>
parents: 15990
diff changeset
3001 "<StockItem>", PIDGIN_STOCK_TOOLBAR_UNBLOCK },
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3002 { N_("/Conversation/_Add..."), NULL, menu_add_remove_cb, 0,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3003 "<StockItem>", GTK_STOCK_ADD },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3004 { N_("/Conversation/_Remove..."), NULL, menu_add_remove_cb, 0,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3005 "<StockItem>", GTK_STOCK_REMOVE },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3006
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3007 { "/Conversation/sep3", NULL, NULL, 0, "<Separator>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3008
17776
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3009 { N_("/Conversation/Insert Lin_k..."), NULL, menu_insert_link_cb, 0,
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3010 "<StockItem>", PIDGIN_STOCK_TOOLBAR_INSERT_LINK },
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3011 { N_("/Conversation/Insert Imag_e..."), NULL, menu_insert_image_cb, 0,
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3012 "<StockItem>", PIDGIN_STOCK_TOOLBAR_INSERT_IMAGE },
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3013
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3014 { "/Conversation/sep4", NULL, NULL, 0, "<Separator>", NULL },
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3015
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3016
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3017 { N_("/Conversation/_Close"), NULL, menu_close_conv_cb, 0,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3018 "<StockItem>", GTK_STOCK_CLOSE },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3019
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3020 /* Options */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3021 { N_("/_Options"), NULL, NULL, 0, "<Branch>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3022 { N_("/Options/Enable _Logging"), NULL, menu_logging_cb, 0, "<CheckItem>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3023 { N_("/Options/Enable _Sounds"), NULL, menu_sounds_cb, 0, "<CheckItem>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3024 { "/Options/sep0", NULL, NULL, 0, "<Separator>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3025 { N_("/Options/Show Formatting _Toolbars"), NULL, menu_toolbar_cb, 0, "<CheckItem>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3026 { N_("/Options/Show Ti_mestamps"), "F2", menu_timestamps_cb, 0, "<CheckItem>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3027 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3028
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3029 static const int menu_item_count =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3030 sizeof(menu_items) / sizeof(*menu_items);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3031
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3032 static const char *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3033 item_factory_translate_func (const char *path, gpointer func_data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3034 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3035 return _(path);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3036 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3037
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3038 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3039 sound_method_pref_changed_cb(const char *name, PurplePrefType type,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3040 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3041 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3042 PidginWindow *win = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3043 const char *method = value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3044
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3045 if (!strcmp(method, "none"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3046 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3047 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3048 FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3049 gtk_widget_set_sensitive(win->menu.sounds, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3050 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3051 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3052 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3053 PidginConversation *gtkconv = pidgin_conv_window_get_active_gtkconv(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3054
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3055 if (gtkconv != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3056 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds),
19980
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
3057 gtkconv->make_sound);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3058 gtk_widget_set_sensitive(win->menu.sounds, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3059
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3060 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3061 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3062
18658
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3063 /* Returns TRUE if some items were added to the menu, FALSE otherwise */
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3064 static gboolean
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3065 populate_menu_with_options(GtkWidget *menu, PidginConversation *gtkconv, gboolean all)
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3066 {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3067 GList *list;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3068 PurpleConversation *conv;
17725
1873848dfddb Make the Conversation->More menu work for Chats. The chat needs to be on
Stu Tomlinson <stu@nosnilmot.com>
parents: 17556
diff changeset
3069 PurpleBlistNode *node = NULL;
1873848dfddb Make the Conversation->More menu work for Chats. The chat needs to be on
Stu Tomlinson <stu@nosnilmot.com>
parents: 17556
diff changeset
3070 PurpleChat *chat = NULL;
1873848dfddb Make the Conversation->More menu work for Chats. The chat needs to be on
Stu Tomlinson <stu@nosnilmot.com>
parents: 17556
diff changeset
3071 PurpleBuddy *buddy = NULL;
18658
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3072 gboolean ret;
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3073
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3074 conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3075
17846
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3076 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) {
17725
1873848dfddb Make the Conversation->More menu work for Chats. The chat needs to be on
Stu Tomlinson <stu@nosnilmot.com>
parents: 17556
diff changeset
3077 chat = purple_blist_find_chat(conv->account, conv->name);
17846
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3078
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3079 if ((chat == NULL) && (gtkconv->imhtml != NULL)) {
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3080 chat = g_object_get_data(G_OBJECT(gtkconv->imhtml), "transient_chat");
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3081 }
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3082
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3083 if ((chat == NULL) && (gtkconv->imhtml != NULL)) {
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3084 GHashTable *components;
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3085 components = g_hash_table_new_full(g_str_hash, g_str_equal,
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3086 g_free, g_free);
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3087 g_hash_table_replace(components, g_strdup("channel"),
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3088 g_strdup(conv->name));
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3089 chat = purple_chat_new(conv->account, NULL, components);
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3090 purple_blist_node_set_flags((PurpleBlistNode *)chat,
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3091 PURPLE_BLIST_NODE_FLAG_NO_SAVE);
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3092 g_object_set_data_full(G_OBJECT(gtkconv->imhtml), "transient_chat",
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3093 chat, (GDestroyNotify)purple_blist_remove_chat);
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3094 }
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3095 } else {
21307
5cca0d7d9081 Fix for the crash reported by WormFood in #pidgin when right clicking on
Stu Tomlinson <stu@nosnilmot.com>
parents: 21284
diff changeset
3096 if (!purple_account_is_connected(conv->account))
5cca0d7d9081 Fix for the crash reported by WormFood in #pidgin when right clicking on
Stu Tomlinson <stu@nosnilmot.com>
parents: 21284
diff changeset
3097 return FALSE;
5cca0d7d9081 Fix for the crash reported by WormFood in #pidgin when right clicking on
Stu Tomlinson <stu@nosnilmot.com>
parents: 21284
diff changeset
3098
17725
1873848dfddb Make the Conversation->More menu work for Chats. The chat needs to be on
Stu Tomlinson <stu@nosnilmot.com>
parents: 17556
diff changeset
3099 buddy = purple_find_buddy(conv->account, conv->name);
1873848dfddb Make the Conversation->More menu work for Chats. The chat needs to be on
Stu Tomlinson <stu@nosnilmot.com>
parents: 17556
diff changeset
3100
17846
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3101 /* gotta remain bug-compatible :( libpurple < 2.0.2 didn't handle
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3102 * removing "isolated" buddy nodes well */
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3103 if (purple_version_check(2, 0, 2) == NULL) {
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3104 if ((buddy == NULL) && (gtkconv->imhtml != NULL)) {
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3105 buddy = g_object_get_data(G_OBJECT(gtkconv->imhtml), "transient_buddy");
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3106 }
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3107
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3108 if ((buddy == NULL) && (gtkconv->imhtml != NULL)) {
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3109 buddy = purple_buddy_new(conv->account, conv->name, NULL);
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3110 purple_blist_node_set_flags((PurpleBlistNode *)buddy,
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3111 PURPLE_BLIST_NODE_FLAG_NO_SAVE);
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3112 g_object_set_data_full(G_OBJECT(gtkconv->imhtml), "transient_buddy",
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3113 buddy, (GDestroyNotify)purple_blist_remove_buddy);
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3114 }
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3115 }
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3116 }
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3117
17725
1873848dfddb Make the Conversation->More menu work for Chats. The chat needs to be on
Stu Tomlinson <stu@nosnilmot.com>
parents: 17556
diff changeset
3118 if (chat)
1873848dfddb Make the Conversation->More menu work for Chats. The chat needs to be on
Stu Tomlinson <stu@nosnilmot.com>
parents: 17556
diff changeset
3119 node = (PurpleBlistNode *)chat;
1873848dfddb Make the Conversation->More menu work for Chats. The chat needs to be on
Stu Tomlinson <stu@nosnilmot.com>
parents: 17556
diff changeset
3120 else if (buddy)
1873848dfddb Make the Conversation->More menu work for Chats. The chat needs to be on
Stu Tomlinson <stu@nosnilmot.com>
parents: 17556
diff changeset
3121 node = (PurpleBlistNode *)buddy;
1873848dfddb Make the Conversation->More menu work for Chats. The chat needs to be on
Stu Tomlinson <stu@nosnilmot.com>
parents: 17556
diff changeset
3122
18658
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3123 /* Now add the stuff */
19616
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
3124 if (all) {
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
3125 if (buddy)
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
3126 pidgin_blist_make_buddy_menu(menu, buddy, TRUE);
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
3127 else if (chat) {
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
3128 /* XXX: */
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
3129 }
18658
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3130 } else if (node) {
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3131 if (purple_account_is_connected(conv->account))
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3132 pidgin_append_blist_node_proto_menu(menu, conv->account->gc, node);
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3133 pidgin_append_blist_node_extended_menu(menu, node);
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3134 }
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3135
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3136 if ((list = gtk_container_get_children(GTK_CONTAINER(menu))) == NULL) {
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3137 ret = FALSE;
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3138 } else {
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3139 g_list_free(list);
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3140 ret = TRUE;
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3141 }
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3142 return ret;
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3143 }
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3144
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3145 static void
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3146 regenerate_options_items(PidginWindow *win)
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3147 {
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3148 GtkWidget *menu;
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3149 PidginConversation *gtkconv;
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3150 GList *list;
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3151
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3152 gtkconv = pidgin_conv_window_get_active_gtkconv(win);
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3153 menu = gtk_item_factory_get_widget(win->menu.item_factory, N_("/Conversation/More"));
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3154
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3155 /* Remove the previous entries */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3156 for (list = gtk_container_get_children(GTK_CONTAINER(menu)); list; )
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3157 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3158 GtkWidget *w = list->data;
18646
05cab350d1fb Fix memory leak by freeing the list returned by gtk_container_get_children.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18632
diff changeset
3159 list = g_list_delete_link(list, list);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3160 gtk_widget_destroy(w);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3161 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3162
18658
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3163 if (!populate_menu_with_options(menu, gtkconv, FALSE))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3164 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3165 GtkWidget *item = gtk_menu_item_new_with_label(_("No actions available"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3166 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3167 gtk_widget_set_sensitive(item, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3168 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3169
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3170 gtk_widget_show_all(menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3171 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3172
17392
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3173 static void
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3174 remove_from_list(GtkWidget *widget, PidginWindow *win)
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3175 {
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3176 GList *list = g_object_get_data(G_OBJECT(win->window), "plugin-actions");
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3177 list = g_list_remove(list, widget);
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3178 g_object_set_data(G_OBJECT(win->window), "plugin-actions", list);
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3179 }
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3180
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3181 static void
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3182 regenerate_plugins_items(PidginWindow *win)
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3183 {
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3184 GList *action_items;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3185 GtkWidget *menu;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3186 GList *list;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3187 PidginConversation *gtkconv;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3188 PurpleConversation *conv;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3189 GtkWidget *item;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3190
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
3191 if (win->window == NULL || win == hidden_convwin)
17392
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3192 return;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3193
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3194 gtkconv = pidgin_conv_window_get_active_gtkconv(win);
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3195 if (gtkconv == NULL)
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3196 return;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3197
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3198 conv = gtkconv->active_conv;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3199 action_items = g_object_get_data(G_OBJECT(win->window), "plugin-actions");
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3200
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3201 /* Remove the old menuitems */
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3202 while (action_items) {
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3203 g_signal_handlers_disconnect_by_func(G_OBJECT(action_items->data),
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3204 G_CALLBACK(remove_from_list), win);
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3205 gtk_widget_destroy(action_items->data);
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3206 action_items = g_list_delete_link(action_items, action_items);
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3207 }
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3208
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3209 menu = gtk_item_factory_get_widget(win->menu.item_factory, N_("/Options"));
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3210
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3211 list = purple_conversation_get_extended_menu(conv);
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3212 if (list) {
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3213 action_items = g_list_prepend(NULL, (item = pidgin_separator(menu)));
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3214 g_signal_connect(G_OBJECT(item), "destroy", G_CALLBACK(remove_from_list), win);
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3215 }
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3216
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3217 for(; list; list = g_list_delete_link(list, list)) {
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3218 PurpleMenuAction *act = (PurpleMenuAction *) list->data;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3219 item = pidgin_append_menu_action(menu, act, conv);
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3220 action_items = g_list_prepend(action_items, item);
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3221 gtk_widget_show_all(item);
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3222 g_signal_connect(G_OBJECT(item), "destroy", G_CALLBACK(remove_from_list), win);
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3223 }
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3224 g_object_set_data(G_OBJECT(win->window), "plugin-actions", action_items);
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3225 }
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3226
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3227 static void menubar_activated(GtkWidget *item, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3228 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3229 PidginWindow *win = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3230 regenerate_options_items(win);
17392
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3231 regenerate_plugins_items(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3232
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3233 /* The following are to make sure the 'More' submenu is not regenerated every time
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3234 * the focus shifts from 'Conversations' to some other menu and back. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3235 g_signal_handlers_block_by_func(G_OBJECT(item), G_CALLBACK(menubar_activated), data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3236 g_signal_connect(G_OBJECT(win->menu.menubar), "deactivate", G_CALLBACK(focus_out_from_menubar), data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3237 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3238
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3239 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3240 focus_out_from_menubar(GtkWidget *wid, PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3241 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3242 /* The menubar has been deactivated. Make sure the 'More' submenu is regenerated next time
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3243 * the 'Conversation' menu pops up. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3244 GtkWidget *menuitem = gtk_item_factory_get_item(win->menu.item_factory, N_("/Conversation"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3245 g_signal_handlers_unblock_by_func(G_OBJECT(menuitem), G_CALLBACK(menubar_activated), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3246 g_signal_handlers_disconnect_by_func(G_OBJECT(win->menu.menubar),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3247 G_CALLBACK(focus_out_from_menubar), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3248 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3249
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3250 static GtkWidget *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3251 setup_menubar(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3252 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3253 GtkAccelGroup *accel_group;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3254 const char *method;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3255 GtkWidget *menuitem;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3256
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3257 accel_group = gtk_accel_group_new ();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3258 gtk_window_add_accel_group(GTK_WINDOW(win->window), accel_group);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3259 g_object_unref(accel_group);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3260
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3261 win->menu.item_factory =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3262 gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", accel_group);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3263
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3264 gtk_item_factory_set_translate_func(win->menu.item_factory,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3265 (GtkTranslateFunc)item_factory_translate_func,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3266 NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3267
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3268 gtk_item_factory_create_items(win->menu.item_factory, menu_item_count,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3269 menu_items, win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3270 g_signal_connect(G_OBJECT(accel_group), "accel-changed",
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3271 G_CALLBACK(pidgin_save_accels_cb), NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3272
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3273 /* Make sure the 'Conversation -> More' menuitems are regenerated whenever
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3274 * the 'Conversation' menu pops up because the entries can change after the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3275 * conversation is created. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3276 menuitem = gtk_item_factory_get_item(win->menu.item_factory, N_("/Conversation"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3277 g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(menubar_activated), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3278
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3279 win->menu.menubar =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3280 gtk_item_factory_get_widget(win->menu.item_factory, "<main>");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3281
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3282 win->menu.view_log =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3283 gtk_item_factory_get_widget(win->menu.item_factory,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3284 N_("/Conversation/View Log"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3285
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3286 /* --- */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3287
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3288 win->menu.send_file =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3289 gtk_item_factory_get_widget(win->menu.item_factory,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3290 N_("/Conversation/Send File..."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3291
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3292 win->menu.add_pounce =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3293 gtk_item_factory_get_widget(win->menu.item_factory,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3294 N_("/Conversation/Add Buddy Pounce..."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3295
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3296 /* --- */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3297
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3298 win->menu.get_info =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3299 gtk_item_factory_get_widget(win->menu.item_factory,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3300 N_("/Conversation/Get Info"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3301
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3302 win->menu.invite =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3303 gtk_item_factory_get_widget(win->menu.item_factory,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3304 N_("/Conversation/Invite..."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3305
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3306 /* --- */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3307
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3308 win->menu.alias =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3309 gtk_item_factory_get_widget(win->menu.item_factory,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3310 N_("/Conversation/Alias..."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3311
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3312 win->menu.block =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3313 gtk_item_factory_get_widget(win->menu.item_factory,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3314 N_("/Conversation/Block..."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3315
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
3316 win->menu.unblock =
15426
c9497aad9fc4 Warmenhoved patch #1397916: "Turns Block button in conv menu into Unblock after blocking" from Glauber de Oliveira Costa (glommer). You know the drill.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15374
diff changeset
3317 gtk_item_factory_get_widget(win->menu.item_factory,
c9497aad9fc4 Warmenhoved patch #1397916: "Turns Block button in conv menu into Unblock after blocking" from Glauber de Oliveira Costa (glommer). You know the drill.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15374
diff changeset
3318 N_("/Conversation/Unblock..."));
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
3319
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3320 win->menu.add =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3321 gtk_item_factory_get_widget(win->menu.item_factory,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3322 N_("/Conversation/Add..."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3323
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3324 win->menu.remove =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3325 gtk_item_factory_get_widget(win->menu.item_factory,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3326 N_("/Conversation/Remove..."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3327
17776
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3328 /* --- */
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3329
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3330 win->menu.insert_link =
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3331 gtk_item_factory_get_widget(win->menu.item_factory,
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3332 N_("/Conversation/Insert Link..."));
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3333
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3334 win->menu.insert_image =
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3335 gtk_item_factory_get_widget(win->menu.item_factory,
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3336 N_("/Conversation/Insert Image..."));
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3337
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3338 /* --- */
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3339
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3340 win->menu.logging =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3341 gtk_item_factory_get_widget(win->menu.item_factory,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3342 N_("/Options/Enable Logging"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3343 win->menu.sounds =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3344 gtk_item_factory_get_widget(win->menu.item_factory,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3345 N_("/Options/Enable Sounds"));
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
3346 method = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method");
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
3347 if (method != NULL && !strcmp(method, "none"))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3348 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3349 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3350 FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3351 gtk_widget_set_sensitive(win->menu.sounds, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3352 }
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
3353 purple_prefs_connect_callback(win, PIDGIN_PREFS_ROOT "/sound/method",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3354 sound_method_pref_changed_cb, win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3355
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3356 win->menu.show_formatting_toolbar =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3357 gtk_item_factory_get_widget(win->menu.item_factory,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3358 N_("/Options/Show Formatting Toolbars"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3359 win->menu.show_timestamps =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3360 gtk_item_factory_get_widget(win->menu.item_factory,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3361 N_("/Options/Show Timestamps"));
19617
95fd392bf304 Remove 'show buddy icon' leftovers to get rid of run time gtk+ warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19616
diff changeset
3362 win->menu.show_icon = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3363
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3364 win->menu.tray = pidgin_menu_tray_new();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3365 gtk_menu_shell_append(GTK_MENU_SHELL(win->menu.menubar),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3366 win->menu.tray);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3367 gtk_widget_show(win->menu.tray);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3368
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3369 gtk_widget_show(win->menu.menubar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3370
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3371 return win->menu.menubar;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3372 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3375 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3376 * Utility functions
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3377 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3378
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3379 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3380 got_typing_keypress(PidginConversation *gtkconv, gboolean first)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3381 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3382 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3383 PurpleConvIm *im;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3384
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3385 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3386 * We know we got something, so we at least have to make sure we don't
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3387 * send PURPLE_TYPED any time soon.
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3388 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3389
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3390 im = PURPLE_CONV_IM(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3391
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3392 purple_conv_im_stop_send_typed_timeout(im);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3393 purple_conv_im_start_send_typed_timeout(im);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3394
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3395 /* Check if we need to send another PURPLE_TYPING message */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3396 if (first || (purple_conv_im_get_type_again(im) != 0 &&
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3397 time(NULL) > purple_conv_im_get_type_again(im)))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3398 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3399 unsigned int timeout;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3400 timeout = serv_send_typing(purple_conversation_get_gc(conv),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3401 purple_conversation_get_name(conv),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3402 PURPLE_TYPING);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3403 purple_conv_im_set_type_again(im, timeout);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3404 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3405 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3406
15725
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3407 static gboolean
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3408 typing_animation(gpointer data) {
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3409 PidginConversation *gtkconv = data;
15984
50d949d6bda2 don't show the typing animation when the typing conversation isn't the active tab
Nathan Walp <nwalp@pidgin.im>
parents: 15885
diff changeset
3410 PidginWindow *gtkwin = gtkconv->win;
15725
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3411 const char *stock_id = NULL;
15984
50d949d6bda2 don't show the typing animation when the typing conversation isn't the active tab
Nathan Walp <nwalp@pidgin.im>
parents: 15885
diff changeset
3412
50d949d6bda2 don't show the typing animation when the typing conversation isn't the active tab
Nathan Walp <nwalp@pidgin.im>
parents: 15885
diff changeset
3413 if(gtkconv != pidgin_conv_window_get_active_gtkconv(gtkwin)) {
50d949d6bda2 don't show the typing animation when the typing conversation isn't the active tab
Nathan Walp <nwalp@pidgin.im>
parents: 15885
diff changeset
3414 return FALSE;
50d949d6bda2 don't show the typing animation when the typing conversation isn't the active tab
Nathan Walp <nwalp@pidgin.im>
parents: 15885
diff changeset
3415 }
50d949d6bda2 don't show the typing animation when the typing conversation isn't the active tab
Nathan Walp <nwalp@pidgin.im>
parents: 15885
diff changeset
3416
15725
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3417 switch (rand() % 5) {
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3418 case 0:
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3419 stock_id = PIDGIN_STOCK_ANIMATION_TYPING0;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3420 break;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3421 case 1:
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3422 stock_id = PIDGIN_STOCK_ANIMATION_TYPING1;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3423 break;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3424 case 2:
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3425 stock_id = PIDGIN_STOCK_ANIMATION_TYPING2;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3426 break;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3427 case 3:
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3428 stock_id = PIDGIN_STOCK_ANIMATION_TYPING3;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3429 break;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3430 case 4:
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3431 stock_id = PIDGIN_STOCK_ANIMATION_TYPING4;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3432 break;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3433 }
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3434 if (gtkwin->menu.typing_icon == NULL) {
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3435 gtkwin->menu.typing_icon = gtk_image_new_from_stock(stock_id, GTK_ICON_SIZE_MENU);
17002
af4181dde6fa fix the typing animation so it doesn't stop animating once a conversation
Nathan Walp <nwalp@pidgin.im>
parents: 16988
diff changeset
3436 pidgin_menu_tray_append(PIDGIN_MENU_TRAY(gtkwin->menu.tray),
15725
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3437 gtkwin->menu.typing_icon,
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3438 _("User is typing..."));
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3439 } else {
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3440 gtk_image_set_from_stock(GTK_IMAGE(gtkwin->menu.typing_icon), stock_id, GTK_ICON_SIZE_MENU);
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3441 }
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3442 gtk_widget_show(gtkwin->menu.typing_icon);
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3443 return TRUE;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3444 }
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3445
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3446 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3447 update_typing_icon(PidginConversation *gtkconv)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3448 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3449 PidginWindow *gtkwin;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3450 PurpleConvIm *im = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3451 PurpleConversation *conv = gtkconv->active_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3452 char *stock_id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3453 const char *tooltip;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3454
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3455 gtkwin = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3456
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3457 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3458 im = PURPLE_CONV_IM(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3459
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3460 if (gtkwin->menu.typing_icon) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3461 gtk_widget_hide(gtkwin->menu.typing_icon);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3462 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3463
16577
99bf55ec6ca4 Fix an invalid read that occurs because we were accessing IM data when the
Richard Laager <rlaager@wiktel.com>
parents: 16483
diff changeset
3464 if (im == NULL)
99bf55ec6ca4 Fix an invalid read that occurs because we were accessing IM data when the
Richard Laager <rlaager@wiktel.com>
parents: 16483
diff changeset
3465 return;
99bf55ec6ca4 Fix an invalid read that occurs because we were accessing IM data when the
Richard Laager <rlaager@wiktel.com>
parents: 16483
diff changeset
3466
99bf55ec6ca4 Fix an invalid read that occurs because we were accessing IM data when the
Richard Laager <rlaager@wiktel.com>
parents: 16483
diff changeset
3467 if (purple_conv_im_get_typing_state(im) == PURPLE_NOT_TYPING) {
17002
af4181dde6fa fix the typing animation so it doesn't stop animating once a conversation
Nathan Walp <nwalp@pidgin.im>
parents: 16988
diff changeset
3468 if (gtkconv->u.im->typing_timer != 0) {
15725
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3469 g_source_remove(gtkconv->u.im->typing_timer);
17002
af4181dde6fa fix the typing animation so it doesn't stop animating once a conversation
Nathan Walp <nwalp@pidgin.im>
parents: 16988
diff changeset
3470 gtkconv->u.im->typing_timer = 0;
af4181dde6fa fix the typing animation so it doesn't stop animating once a conversation
Nathan Walp <nwalp@pidgin.im>
parents: 16988
diff changeset
3471 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3472 return;
15725
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3473 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3474
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3475 if (purple_conv_im_get_typing_state(im) == PURPLE_TYPING) {
15725
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3476 if (gtkconv->u.im->typing_timer == 0) {
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3477 gtkconv->u.im->typing_timer = g_timeout_add(250, typing_animation, gtkconv);
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3478 }
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3479 stock_id = PIDGIN_STOCK_ANIMATION_TYPING1;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3480 tooltip = _("User is typing...");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3481 } else {
17050
580c6c5d9480 Make 'typed' icon not have any keys depressed. Should fix #1116
Sean Egan <seanegan@gmail.com>
parents: 17045
diff changeset
3482 stock_id = PIDGIN_STOCK_ANIMATION_TYPING5;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3483 tooltip = _("User has typed something and stopped");
19230
da310fe624f1 Don't try to remove a timer that doesn't exist
Mark Doliner <mark@kingant.net>
parents: 19229
diff changeset
3484 if (gtkconv->u.im->typing_timer != 0) {
da310fe624f1 Don't try to remove a timer that doesn't exist
Mark Doliner <mark@kingant.net>
parents: 19229
diff changeset
3485 g_source_remove(gtkconv->u.im->typing_timer);
da310fe624f1 Don't try to remove a timer that doesn't exist
Mark Doliner <mark@kingant.net>
parents: 19229
diff changeset
3486 gtkconv->u.im->typing_timer = 0;
da310fe624f1 Don't try to remove a timer that doesn't exist
Mark Doliner <mark@kingant.net>
parents: 19229
diff changeset
3487 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3488 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3489
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3490 if (gtkwin->menu.typing_icon == NULL)
16315
ee4ce3c4186f Fix #248 (Control shouldn't steal focus from scrollback)
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16286
diff changeset
3491 {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3492 gtkwin->menu.typing_icon = gtk_image_new_from_stock(stock_id, GTK_ICON_SIZE_MENU);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3493 pidgin_menu_tray_append(PIDGIN_MENU_TRAY(gtkwin->menu.tray),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3494 gtkwin->menu.typing_icon,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3495 tooltip);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3496 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3497 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3498 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3499 gtk_image_set_from_stock(GTK_IMAGE(gtkwin->menu.typing_icon), stock_id, GTK_ICON_SIZE_MENU);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3500 pidgin_menu_tray_set_tooltip(PIDGIN_MENU_TRAY(gtkwin->menu.tray),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3501 gtkwin->menu.typing_icon,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3502 tooltip);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3503 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3504
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3505 gtk_widget_show(gtkwin->menu.typing_icon);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3506 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3507
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3508 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3509 update_send_to_selection(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3510 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3511 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3512 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3513 GtkWidget *menu;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3514 GList *child;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3515 PurpleBuddy *b;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3516
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3517 conv = pidgin_conv_window_get_active_conversation(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3518
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3519 if (conv == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3520 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3521
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3522 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3523
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3524 if (account == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3525 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3526
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3527 if (win->menu.send_to == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3528 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3529
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3530 if (!(b = purple_find_buddy(account, conv->name)))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3531 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3532
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3533
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3534 gtk_widget_show(win->menu.send_to);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3535
18658
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3536 menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(win->menu.send_to));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3537
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3538 for (child = gtk_container_get_children(GTK_CONTAINER(menu));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3539 child != NULL;
18646
05cab350d1fb Fix memory leak by freeing the list returned by gtk_container_get_children.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18632
diff changeset
3540 child = g_list_delete_link(child, child)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3541
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3542 GtkWidget *item = child->data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3543 PurpleBuddy *item_buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3544 PurpleAccount *item_account = g_object_get_data(G_OBJECT(item), "purple_account");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3545 gchar *buddy_name = g_object_get_data(G_OBJECT(item),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3546 "purple_buddy_name");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3547 item_buddy = purple_find_buddy(item_account, buddy_name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3548
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3549 if (b == item_buddy) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3550 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE);
20944
91ce973a950b Prevent the rest of the list being leaked.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20920
diff changeset
3551 g_list_free(child);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3552 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3553 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3554 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3555
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3556 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3557 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3558
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3559 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3560 send_to_item_enter_notify_cb(GtkWidget *menuitem, GdkEventCrossing *event, GtkWidget *label)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3561 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3562 gtk_widget_set_sensitive(GTK_WIDGET(label), TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3563 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3564 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3565
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3566 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3567 send_to_item_leave_notify_cb(GtkWidget *menuitem, GdkEventCrossing *event, GtkWidget *label)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3568 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3569 gtk_widget_set_sensitive(GTK_WIDGET(label), FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3570 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3571 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3572
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3573 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3574 create_sendto_item(GtkWidget *menu, GtkSizeGroup *sg, GSList **group, PurpleBuddy *buddy, PurpleAccount *account, const char *name)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3575 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3576 GtkWidget *box;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3577 GtkWidget *label;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3578 GtkWidget *image;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3579 GtkWidget *menuitem;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3580 GdkPixbuf *pixbuf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3581 gchar *text;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3582
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3583 /* Create a pixmap for the protocol icon. */
15542
a1e0b153fc30 prpl icons in Send To menu
Sean Egan <seanegan@gmail.com>
parents: 15534
diff changeset
3584 pixbuf = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_SMALL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3585
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3586 /* Now convert it to GtkImage */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3587 if (pixbuf == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3588 image = gtk_image_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3589 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3590 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3591 image = gtk_image_new_from_pixbuf(pixbuf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3592 g_object_unref(G_OBJECT(pixbuf));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3593 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3594
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3595 gtk_size_group_add_widget(sg, image);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3596
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3597 /* Make our menu item */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3598 text = g_strdup_printf("%s (%s)", name, purple_account_get_username(account));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3599 menuitem = gtk_radio_menu_item_new_with_label(*group, text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3600 g_free(text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3601 *group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3602
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3603 /* Do some evil, see some evil, speak some evil. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3604 box = gtk_hbox_new(FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3605
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3606 label = gtk_bin_get_child(GTK_BIN(menuitem));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3607 g_object_ref(label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3608 gtk_container_remove(GTK_CONTAINER(menuitem), label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3609
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3610 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3611 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3612
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3613 if (buddy != NULL &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3614 !purple_presence_is_online(purple_buddy_get_presence(buddy)) &&
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3615 !purple_account_supports_offline_message(account, buddy))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3616 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3617 gtk_widget_set_sensitive(label, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3618
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3619 /* Set the label sensitive when the menuitem is highlighted and
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3620 * insensitive again when the mouse leaves it. This way, it
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3621 * doesn't appear weird from the highlighting of the embossed
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3622 * (insensitive style) text.*/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3623 g_signal_connect(menuitem, "enter-notify-event",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3624 G_CALLBACK(send_to_item_enter_notify_cb), label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3625 g_signal_connect(menuitem, "leave-notify-event",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3626 G_CALLBACK(send_to_item_leave_notify_cb), label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3627 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3628
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3629 g_object_unref(label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3630
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3631 gtk_container_add(GTK_CONTAINER(menuitem), box);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3632
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3633 gtk_widget_show(label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3634 gtk_widget_show(image);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3635 gtk_widget_show(box);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3636
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3637 /* Set our data and callbacks. */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3638 g_object_set_data(G_OBJECT(menuitem), "purple_account", account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3639 g_object_set_data_full(G_OBJECT(menuitem), "purple_buddy_name", g_strdup(name), g_free);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3640
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3641 g_signal_connect(G_OBJECT(menuitem), "activate",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3642 G_CALLBACK(menu_conv_sel_send_cb), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3643
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3644 gtk_widget_show(menuitem);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3645 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3646 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3647
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3648 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3649 generate_send_to_items(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3650 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3651 GtkWidget *menu;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3652 GSList *group = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3653 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3654 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3655 GSList *l, *buds;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3656
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3657 g_return_if_fail(win != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3658
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3659 gtkconv = pidgin_conv_window_get_active_gtkconv(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3660
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3661 g_return_if_fail(gtkconv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3662
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3663 if (win->menu.send_to != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3664 gtk_widget_destroy(win->menu.send_to);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3665
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3666 /* Build the Send To menu */
25467
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 16358
diff changeset
3667 #if ENABLE_SHORTCUT
20545
4a8407152e9a Change _Send To mnemonic to avoid conflicting with Smile
Sean Egan <seanegan@gmail.com>
parents: 20173
diff changeset
3668 win->menu.send_to = gtk_menu_item_new_with_mnemonic(_("S_end To"));
25467
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 16358
diff changeset
3669 #else
25504
e556eb2f38d2 - add hankaku kana support to irc.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 25501
diff changeset
3670 win->menu.send_to = gtk_menu_item_new_with_mnemonic(_("Send To")); //to free Alt-s. intentional. --yaz
25467
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 16358
diff changeset
3671 #endif
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3672 gtk_widget_show(win->menu.send_to);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3673
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3674 menu = gtk_menu_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3675 gtk_menu_shell_insert(GTK_MENU_SHELL(win->menu.menubar),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3676 win->menu.send_to, 2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3677 gtk_menu_item_set_submenu(GTK_MENU_ITEM(win->menu.send_to), menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3678
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3679 gtk_widget_show(menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3680
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3681 if (gtkconv->active_conv->type == PURPLE_CONV_TYPE_IM) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3682 buds = purple_find_buddies(gtkconv->active_conv->account, gtkconv->active_conv->name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3683
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3684 if (buds == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3685 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3686 /* The user isn't on the buddy list. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3687 create_sendto_item(menu, sg, &group, NULL, gtkconv->active_conv->account, gtkconv->active_conv->name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3688 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3689 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3690 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3691 GList *list = NULL, *iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3692 for (l = buds; l != NULL; l = l->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3693 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3694 PurpleBlistNode *node;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3695
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3696 node = (PurpleBlistNode *) purple_buddy_get_contact((PurpleBuddy *)l->data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3697
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3698 for (node = node->child; node != NULL; node = node->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3699 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3700 PurpleBuddy *buddy = (PurpleBuddy *)node;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3701 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3702
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3703 if (!PURPLE_BLIST_NODE_IS_BUDDY(node))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3704 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3705
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3706 account = purple_buddy_get_account(buddy);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3707 if (purple_account_is_connected(account))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3708 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3709 /* Use the PurplePresence to get unique buddies. */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3710 PurplePresence *presence = purple_buddy_get_presence(buddy);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3711 if (!g_list_find(list, presence))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3712 list = g_list_prepend(list, presence);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3713 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3714 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3715 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3716
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3717 /* Loop over the list backwards so we get the items in the right order,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3718 * since we did a g_list_prepend() earlier. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3719 for (iter = g_list_last(list); iter != NULL; iter = iter->prev)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3720 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3721 PurplePresence *pre = iter->data;
16809
c4460fa22886 Change some of the PurplePresence stuff to reflect how it's actually used
Sean Egan <seanegan@gmail.com>
parents: 16681
diff changeset
3722 PurpleBuddy *buddy = purple_presence_get_buddy(pre);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3723 create_sendto_item(menu, sg, &group, buddy,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3724 purple_buddy_get_account(buddy), purple_buddy_get_name(buddy));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3725 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3726 g_list_free(list);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3727 g_slist_free(buds);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3728 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3729 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3730
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3731 g_object_unref(sg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3732
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3733 gtk_widget_show(win->menu.send_to);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3734 /* TODO: This should never be insensitive. Possibly hidden or not. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3735 if (!group)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3736 gtk_widget_set_sensitive(win->menu.send_to, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3737 update_send_to_selection(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3738 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3739
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3740 static GList *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3741 generate_invite_user_names(PurpleConnection *gc)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3742 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3743 PurpleBlistNode *gnode,*cnode,*bnode;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3744 static GList *tmp = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3745
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3746 g_list_free(tmp);
20028
a2b4eac83902 Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19980
diff changeset
3747 tmp = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3748
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3749 if (gc != NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3750 for(gnode = purple_get_blist()->root; gnode; gnode = gnode->next) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3751 if(!PURPLE_BLIST_NODE_IS_GROUP(gnode))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3752 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3753 for(cnode = gnode->child; cnode; cnode = cnode->next) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3754 if(!PURPLE_BLIST_NODE_IS_CONTACT(cnode))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3755 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3756 for(bnode = cnode->child; bnode; bnode = bnode->next) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3757 PurpleBuddy *buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3758
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3759 if(!PURPLE_BLIST_NODE_IS_BUDDY(bnode))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3760 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3761
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3762 buddy = (PurpleBuddy *)bnode;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3763
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3764 if (buddy->account == gc->account &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3765 PURPLE_BUDDY_IS_ONLINE(buddy))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3766 tmp = g_list_insert_sorted(tmp, buddy->name,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3767 (GCompareFunc)g_utf8_collate);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3768 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3769 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3770 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3771 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3772
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3773 return tmp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3774 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3775
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3776 static GdkPixbuf *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3777 get_chat_buddy_status_icon(PurpleConvChat *chat, const char *name, PurpleConvChatBuddyFlags flags)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3778 {
15672
0457791756e7 New chatlist icons. founder and ignored still needed.
Sean Egan <seanegan@gmail.com>
parents: 15632
diff changeset
3779 PidginConversation *gtkconv = PIDGIN_CONVERSATION(chat->conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3780 GdkPixbuf *pixbuf, *scale, *scale2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3781 char *filename;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3782 const char *image = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3783
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3784 if (flags & PURPLE_CBFLAGS_FOUNDER) {
15699
1229a0cd9126 docklet pending status
Sean Egan <seanegan@gmail.com>
parents: 15672
diff changeset
3785 image = PIDGIN_STOCK_STATUS_FOUNDER;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3786 } else if (flags & PURPLE_CBFLAGS_OP) {
15672
0457791756e7 New chatlist icons. founder and ignored still needed.
Sean Egan <seanegan@gmail.com>
parents: 15632
diff changeset
3787 image = PIDGIN_STOCK_STATUS_OPERATOR;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3788 } else if (flags & PURPLE_CBFLAGS_HALFOP) {
15672
0457791756e7 New chatlist icons. founder and ignored still needed.
Sean Egan <seanegan@gmail.com>
parents: 15632
diff changeset
3789 image = PIDGIN_STOCK_STATUS_HALFOP;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3790 } else if (flags & PURPLE_CBFLAGS_VOICE) {
15672
0457791756e7 New chatlist icons. founder and ignored still needed.
Sean Egan <seanegan@gmail.com>
parents: 15632
diff changeset
3791 image = PIDGIN_STOCK_STATUS_VOICE;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3792 } else if ((!flags) && purple_conv_chat_is_user_ignored(chat, name)) {
15699
1229a0cd9126 docklet pending status
Sean Egan <seanegan@gmail.com>
parents: 15672
diff changeset
3793 image = PIDGIN_STOCK_STATUS_IGNORED;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3794 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3795 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3796 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3797
15672
0457791756e7 New chatlist icons. founder and ignored still needed.
Sean Egan <seanegan@gmail.com>
parents: 15632
diff changeset
3798 pixbuf = gtk_widget_render_icon (gtkconv->tab_cont, image, gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL),
0457791756e7 New chatlist icons. founder and ignored still needed.
Sean Egan <seanegan@gmail.com>
parents: 15632
diff changeset
3799 "GtkTreeView");
16315
ee4ce3c4186f Fix #248 (Control shouldn't steal focus from scrollback)
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16286
diff changeset
3800
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3801 if (!pixbuf)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3802 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3803
15990
37d928a6579e these are 16x16 now
Nathan Walp <nwalp@pidgin.im>
parents: 15984
diff changeset
3804 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, GDK_INTERP_BILINEAR);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3805 g_object_unref(pixbuf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3806
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3807 if (flags && purple_conv_chat_is_user_ignored(chat, name)) {
16315
ee4ce3c4186f Fix #248 (Control shouldn't steal focus from scrollback)
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16286
diff changeset
3808 /* TODO: the .../status/default directory isn't installed, should it be? */
15885
c6e563dfaa7a More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
3809 filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "status", "default", "ignored.png", NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3810 pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3811 g_free(filename);
15990
37d928a6579e these are 16x16 now
Nathan Walp <nwalp@pidgin.im>
parents: 15984
diff changeset
3812 scale2 = gdk_pixbuf_scale_simple(pixbuf, 16, 16, GDK_INTERP_BILINEAR);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3813 g_object_unref(pixbuf);
15990
37d928a6579e these are 16x16 now
Nathan Walp <nwalp@pidgin.im>
parents: 15984
diff changeset
3814 gdk_pixbuf_composite(scale2, scale, 0, 0, 16, 16, 0, 0, 1, 1, GDK_INTERP_BILINEAR, 192);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3815 g_object_unref(scale2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3816 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3817
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3818 return scale;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3819 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3820
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3821 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3822 add_chat_buddy_common(PurpleConversation *conv, PurpleConvChatBuddy *cb, const char *old_name)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3823 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3824 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3825 PidginChatPane *gtkchat;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3826 PurpleConvChat *chat;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3827 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3828 PurplePluginProtocolInfo *prpl_info;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3829 GtkListStore *ls;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3830 GdkPixbuf *pixbuf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3831 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3832 gboolean is_me = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3833 gboolean is_buddy;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3834 gchar *tmp, *alias_key, *name, *alias;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3835 int flags;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3836
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3837 alias = cb->alias;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3838 name = cb->name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3839 flags = GPOINTER_TO_INT(cb->flags);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3840
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3841 chat = PURPLE_CONV_CHAT(conv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3842 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3843 gtkchat = gtkconv->u.chat;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3844 gc = purple_conversation_get_gc(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3845
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3846 if (!gc || !(prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3847 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3848
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3849 ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3850
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3851 pixbuf = get_chat_buddy_status_icon(chat, name, flags);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3852
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3853 if (!strcmp(chat->nick, purple_normalize(conv->account, old_name != NULL ? old_name : name)))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3854 is_me = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3855
18305
ffd706ec0220 Set and use convchatbuddy->buddy.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18302
diff changeset
3856 is_buddy = cb->buddy;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3857
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3858 tmp = g_utf8_casefold(alias, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3859 alias_key = g_utf8_collate_key(tmp, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3860 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3861
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3862 if (is_me)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3863 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3864 GdkColor send_color;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3865 gdk_color_parse(SEND_COLOR, &send_color);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3866
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3867 #if GTK_CHECK_VERSION(2,6,0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3868 gtk_list_store_insert_with_values(ls, &iter,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3869 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3870 * The GTK docs are mute about the effects of the "row" value for performance.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3871 * X-Chat hardcodes their value to 0 (prepend) and -1 (append), so we will too.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3872 * It *might* be faster to search the gtk_list_store and set row accurately,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3873 * but no one in #gtk+ seems to know anything about it either.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3874 * Inserting in the "wrong" location has no visible ill effects. - F.P.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3875 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3876 -1, /* "row" */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3877 CHAT_USERS_ICON_COLUMN, pixbuf,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3878 CHAT_USERS_ALIAS_COLUMN, alias,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3879 CHAT_USERS_ALIAS_KEY_COLUMN, alias_key,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3880 CHAT_USERS_NAME_COLUMN, name,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3881 CHAT_USERS_FLAGS_COLUMN, flags,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3882 CHAT_USERS_COLOR_COLUMN, &send_color,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3883 CHAT_USERS_WEIGHT_COLUMN, is_buddy ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3884 -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3885 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3886 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3887 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3888 gtk_list_store_insert_with_values(ls, &iter,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3889 -1, /* "row" */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3890 CHAT_USERS_ICON_COLUMN, pixbuf,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3891 CHAT_USERS_ALIAS_COLUMN, alias,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3892 CHAT_USERS_ALIAS_KEY_COLUMN, alias_key,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3893 CHAT_USERS_NAME_COLUMN, name,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3894 CHAT_USERS_FLAGS_COLUMN, flags,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3895 CHAT_USERS_COLOR_COLUMN, get_nick_color(gtkconv, name),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3896 CHAT_USERS_WEIGHT_COLUMN, is_buddy ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3897 -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3898 #else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3899 gtk_list_store_append(ls, &iter);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3900 gtk_list_store_set(ls, &iter,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3901 CHAT_USERS_ICON_COLUMN, pixbuf,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3902 CHAT_USERS_ALIAS_COLUMN, alias,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3903 CHAT_USERS_ALIAS_KEY_COLUMN, alias_key,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3904 CHAT_USERS_NAME_COLUMN, name,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3905 CHAT_USERS_FLAGS_COLUMN, flags,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3906 CHAT_USERS_COLOR_COLUMN, &send_color,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3907 CHAT_USERS_WEIGHT_COLUMN, is_buddy ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3908 -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3909 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3910 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3911 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3912 gtk_list_store_append(ls, &iter);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3913 gtk_list_store_set(ls, &iter,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3914 CHAT_USERS_ICON_COLUMN, pixbuf,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3915 CHAT_USERS_ALIAS_COLUMN, alias,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3916 CHAT_USERS_ALIAS_KEY_COLUMN, alias_key,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3917 CHAT_USERS_NAME_COLUMN, name,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3918 CHAT_USERS_FLAGS_COLUMN, flags,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3919 CHAT_USERS_COLOR_COLUMN, get_nick_color(gtkconv, name),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3920 CHAT_USERS_WEIGHT_COLUMN, is_buddy ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3921 -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3922 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3923 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3924
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3925 if (pixbuf)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3926 g_object_unref(pixbuf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3927 g_free(alias_key);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3928 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3929
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3930 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3931 tab_complete_process_item(int *most_matched, char *entered, char **partial, char *nick_partial,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3932 GList **matches, gboolean command, char *name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3933 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3934 strncpy(nick_partial, name, strlen(entered));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3935 nick_partial[strlen(entered)] = '\0';
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3936 if (purple_utf8_strcasecmp(nick_partial, entered))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3937 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3938
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3939 /* if we're here, it's a possible completion */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3940
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3941 if (*most_matched == -1) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3942 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3943 * this will only get called once, since from now
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3944 * on *most_matched is >= 0
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3945 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3946 *most_matched = strlen(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3947 *partial = g_strdup(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3948 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3949 else if (*most_matched) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3950 char *tmp = g_strdup(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3951
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3952 while (purple_utf8_strcasecmp(tmp, *partial)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3953 (*partial)[*most_matched] = '\0';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3954 if (*most_matched < strlen(tmp))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3955 tmp[*most_matched] = '\0';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3956 (*most_matched)--;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3957 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3958 (*most_matched)++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3959
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3960 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3961 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3962
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3963 *matches = g_list_insert_sorted(*matches, g_strdup(name),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3964 (GCompareFunc)purple_utf8_strcasecmp);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3965 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3966
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3967 static gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3968 tab_complete(PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3969 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3970 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3971 GtkTextIter cursor, word_start, start_buffer;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3972 int start;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3973 int most_matched = -1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3974 char *entered, *partial = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3975 char *text;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3976 char *nick_partial;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3977 const char *prefix;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3978 GList *matches = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3979 gboolean command = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3980
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3981 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3982
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3983 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3984 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3985 gtk_text_buffer_get_insert(gtkconv->entry_buffer));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3986
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3987 word_start = cursor;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3988
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3989 /* if there's nothing there just return */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3990 if (!gtk_text_iter_compare(&cursor, &start_buffer))
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3991 return (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) ? TRUE : FALSE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3992
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3993 text = gtk_text_buffer_get_text(gtkconv->entry_buffer, &start_buffer,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3994 &cursor, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3995
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3996 /* if we're at the end of ": " we need to move back 2 spaces */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3997 start = strlen(text) - 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3998
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3999 if (strlen(text) >= 2 && !strncmp(&text[start-1], ": ", 2)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4000 gtk_text_iter_backward_chars(&word_start, 2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4001 start-=2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4002 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4003
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4004 /* find the start of the word that we're tabbing */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4005 while (start >= 0 && text[start] != ' ') {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4006 gtk_text_iter_backward_char(&word_start);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4007 start--;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4008 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4009
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4010 prefix = pidgin_get_cmd_prefix();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4011 if (start == -1 && (strlen(text) >= strlen(prefix)) && !strncmp(text, prefix, strlen(prefix))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4012 command = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4013 gtk_text_iter_forward_chars(&word_start, strlen(prefix));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4014 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4015
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4016 g_free(text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4017
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4018 entered = gtk_text_buffer_get_text(gtkconv->entry_buffer, &word_start,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4019 &cursor, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4020
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4021 if (!g_utf8_strlen(entered, -1)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4022 g_free(entered);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4023 return (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) ? TRUE : FALSE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4024 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4025
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4026 nick_partial = g_malloc(strlen(entered)+1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4027
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4028 if (command) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4029 GList *list = purple_cmd_list(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4030 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4031
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4032 /* Commands */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4033 for (l = list; l != NULL; l = l->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4034 tab_complete_process_item(&most_matched, entered, &partial, nick_partial,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4035 &matches, TRUE, l->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4036 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4037 g_list_free(list);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4038 } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4039 PurpleConvChat *chat = PURPLE_CONV_CHAT(conv);
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
4040 GList *l = purple_conv_chat_get_users(chat);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4041 GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(PIDGIN_CONVERSATION(conv)->u.chat->list));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4042 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4043 int f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4044
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4045 /* Users */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4046 for (; l != NULL; l = l->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4047 tab_complete_process_item(&most_matched, entered, &partial, nick_partial,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4048 &matches, TRUE, ((PurpleConvChatBuddy *)l->data)->name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4049 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4050
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4051
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4052 /* Aliases */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4053 if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4054 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4055 do {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4056 char *name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4057 char *alias;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4058
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4059 gtk_tree_model_get(model, &iter,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4060 CHAT_USERS_NAME_COLUMN, &name,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4061 CHAT_USERS_ALIAS_COLUMN, &alias,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4062 -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4063
18289
c0e14bceee66 Don't crash on ncik completion if alias or name is NULL. Fixes #1742
Sean Egan <seanegan@gmail.com>
parents: 18263
diff changeset
4064 if (name && alias && strcmp(name, alias))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4065 tab_complete_process_item(&most_matched, entered, &partial, nick_partial,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4066 &matches, FALSE, alias);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4067 g_free(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4068 g_free(alias);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4069
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4070 f = gtk_tree_model_iter_next(model, &iter);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4071 } while (f != 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4072 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4073 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4074 g_free(nick_partial);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4075 g_free(entered);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4076 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4077 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4078
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4079 g_free(nick_partial);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4080
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4081 /* we're only here if we're doing new style */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4082
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4083 /* if there weren't any matches, return */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4084 if (!matches) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4085 /* if matches isn't set partials won't be either */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4086 g_free(entered);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4087 return (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) ? TRUE : FALSE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4088 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4089
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4090 gtk_text_buffer_delete(gtkconv->entry_buffer, &word_start, &cursor);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4091
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4092 if (!matches->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4093 /* there was only one match. fill it in. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4094 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4095 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4096 gtk_text_buffer_get_insert(gtkconv->entry_buffer));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4097
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4098 if (!gtk_text_iter_compare(&cursor, &start_buffer)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4099 char *tmp = g_strdup_printf("%s: ", (char *)matches->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4100 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, tmp, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4101 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4102 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4103 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4104 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4105 matches->data, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4106
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4107 g_free(matches->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4108 matches = g_list_remove(matches, matches->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4109 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4110 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4111 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4112 * there were lots of matches, fill in as much as possible
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4113 * and display all of them
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4114 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4115 char *addthis = g_malloc0(1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4116
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4117 while (matches) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4118 char *tmp = addthis;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4119 addthis = g_strconcat(tmp, matches->data, " ", NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4120 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4121 g_free(matches->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4122 matches = g_list_remove(matches, matches->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4123 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4124
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4125 purple_conversation_write(conv, NULL, addthis, PURPLE_MESSAGE_NO_LOG,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4126 time(NULL));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4127 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, partial, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4128 g_free(addthis);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4129 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4130
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4131 g_free(entered);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4132 g_free(partial);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4133
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4134 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4135 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4136
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4137 static void topic_callback(GtkWidget *w, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4138 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4139 PurplePluginProtocolInfo *prpl_info = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4140 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4141 PurpleConversation *conv = gtkconv->active_conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4142 PidginChatPane *gtkchat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4143 char *new_topic;
25467
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 16358
diff changeset
4144 // const char *current_topic;
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 16358
diff changeset
4145 char dummy[] = "No Topic";
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 16358
diff changeset
4146 char *current_topic = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4147
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4148 gc = purple_conversation_get_gc(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4149
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4150 if(!gc || !(prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4151 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4152
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4153 if(prpl_info->set_chat_topic == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4154 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4155
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4156 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4157 gtkchat = gtkconv->u.chat;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4158 new_topic = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtkchat->topic_text)));
25467
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 16358
diff changeset
4159 // purple_debug_info("yaz gtkconv", "new_topic=%s\n", new_topic);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4160 current_topic = purple_conv_chat_get_topic(PURPLE_CONV_CHAT(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4161
25467
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 16358
diff changeset
4162 if(!current_topic)
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 16358
diff changeset
4163 current_topic = dummy;
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 16358
diff changeset
4164 // purple_debug_info("yaz gtkconv", "current_topic=%s\n", current_topic);
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 16358
diff changeset
4165
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4166 if(current_topic && !g_utf8_collate(new_topic, current_topic)){
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4167 g_free(new_topic);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4168 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4169 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4170
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4171 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), current_topic);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4172 prpl_info->set_chat_topic(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4173 new_topic);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4174
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4175 g_free(new_topic);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4176 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4177
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4178 static gint
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4179 sort_chat_users(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer userdata)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4180 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4181 PurpleConvChatBuddyFlags f1 = 0, f2 = 0;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4182 char *user1 = NULL, *user2 = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4183 gboolean buddy1 = FALSE, buddy2 = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4184 gint ret = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4185
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4186 gtk_tree_model_get(model, a,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4187 CHAT_USERS_ALIAS_KEY_COLUMN, &user1,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4188 CHAT_USERS_FLAGS_COLUMN, &f1,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4189 CHAT_USERS_WEIGHT_COLUMN, &buddy1,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4190 -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4191 gtk_tree_model_get(model, b,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4192 CHAT_USERS_ALIAS_KEY_COLUMN, &user2,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4193 CHAT_USERS_FLAGS_COLUMN, &f2,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4194 CHAT_USERS_WEIGHT_COLUMN, &buddy2,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4195 -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4196
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4197 if (user1 == NULL || user2 == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4198 if (!(user1 == NULL && user2 == NULL))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4199 ret = (user1 == NULL) ? -1: 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4200 } else if (f1 != f2) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4201 /* sort more important users first */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4202 ret = (f1 > f2) ? -1 : 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4203 } else if (buddy1 != buddy2) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4204 ret = (buddy1 > buddy2) ? -1 : 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4205 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4206 ret = strcmp(user1, user2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4207 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4208
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4209 g_free(user1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4210 g_free(user2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4211
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4212 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4213 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4214
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4215 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4216 update_chat_alias(PurpleBuddy *buddy, PurpleConversation *conv, PurpleConnection *gc, PurplePluginProtocolInfo *prpl_info)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4217 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4218 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4219 PurpleConvChat *chat = PURPLE_CONV_CHAT(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4220 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4221 char *normalized_name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4222 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4223 int f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4224
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4225 g_return_if_fail(buddy != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4226 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4227
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4228 /* This is safe because this callback is only used in chats, not IMs. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4229 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkconv->u.chat->list));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4230
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4231 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4232 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4233
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4234 normalized_name = g_strdup(purple_normalize(conv->account, buddy->name));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4235
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4236 do {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4237 char *name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4238
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4239 gtk_tree_model_get(model, &iter, CHAT_USERS_NAME_COLUMN, &name, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4240
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4241 if (!strcmp(normalized_name, purple_normalize(conv->account, name))) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4242 const char *alias = name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4243 char *tmp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4244 char *alias_key = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4245 PurpleBuddy *buddy2;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4246
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4247 if (strcmp(chat->nick, purple_normalize(conv->account, name))) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4248 /* This user is not me, so look into updating the alias. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4249
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4250 if ((buddy2 = purple_find_buddy(conv->account, name)) != NULL) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4251 alias = purple_buddy_get_contact_alias(buddy2);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4252 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4253
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4254 tmp = g_utf8_casefold(alias, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4255 alias_key = g_utf8_collate_key(tmp, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4256 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4257
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4258 gtk_list_store_set(GTK_LIST_STORE(model), &iter,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4259 CHAT_USERS_ALIAS_COLUMN, alias,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4260 CHAT_USERS_ALIAS_KEY_COLUMN, alias_key,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4261 -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4262 g_free(alias_key);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4263 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4264 g_free(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4265 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4266 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4267
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4268 f = gtk_tree_model_iter_next(model, &iter);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4269
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4270 g_free(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4271 } while (f != 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4272
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4273 g_free(normalized_name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4274 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4275
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4276 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4277 blist_node_aliased_cb(PurpleBlistNode *node, const char *old_alias, PurpleConversation *conv)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4278 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4279 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4280 PurplePluginProtocolInfo *prpl_info;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4281
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4282 g_return_if_fail(node != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4283 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4284
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4285 gc = purple_conversation_get_gc(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4286 g_return_if_fail(gc != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4287 g_return_if_fail(gc->prpl != NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4288 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4289
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4290 if (prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4291 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4292
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4293 if (PURPLE_BLIST_NODE_IS_CONTACT(node))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4294 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4295 PurpleBlistNode *bnode;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4296
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4297 for(bnode = node->child; bnode; bnode = bnode->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4298
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4299 if(!PURPLE_BLIST_NODE_IS_BUDDY(bnode))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4300 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4301
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4302 update_chat_alias((PurpleBuddy *)bnode, conv, gc, prpl_info);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4303 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4304 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4305 else if (PURPLE_BLIST_NODE_IS_BUDDY(node))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4306 update_chat_alias((PurpleBuddy *)node, conv, gc, prpl_info);
17107
c30dae34dd33 Update the tab-title for chats immediately after aliasing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17106
diff changeset
4307 else if (PURPLE_BLIST_NODE_IS_CHAT(node) &&
c30dae34dd33 Update the tab-title for chats immediately after aliasing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17106
diff changeset
4308 purple_conversation_get_account(conv) == ((PurpleChat*)node)->account)
c30dae34dd33 Update the tab-title for chats immediately after aliasing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17106
diff changeset
4309 {
c30dae34dd33 Update the tab-title for chats immediately after aliasing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17106
diff changeset
4310 if (old_alias == NULL || g_utf8_collate(old_alias, purple_conversation_get_title(conv)) == 0)
c30dae34dd33 Update the tab-title for chats immediately after aliasing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17106
diff changeset
4311 pidgin_conv_update_fields(conv, PIDGIN_CONV_SET_TITLE);
c30dae34dd33 Update the tab-title for chats immediately after aliasing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17106
diff changeset
4312 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4313 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4314
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4315 static void
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4316 buddy_cb_common(PurpleBuddy *buddy, PurpleConversation *conv, gboolean is_buddy)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4317 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4318 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4319 char *normalized_name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4320 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4321 int f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4322
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4323 g_return_if_fail(buddy != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4324 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4325
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4326 /* Do nothing if the buddy does not belong to the conv's account */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4327 if (purple_buddy_get_account(buddy) != purple_conversation_get_account(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4328 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4329
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4330 /* This is safe because this callback is only used in chats, not IMs. */
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4331 model = gtk_tree_view_get_model(GTK_TREE_VIEW(PIDGIN_CONVERSATION(conv)->u.chat->list));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4332
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4333 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4334 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4335
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4336 normalized_name = g_strdup(purple_normalize(conv->account, buddy->name));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4337
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4338 do {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4339 char *name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4340
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4341 gtk_tree_model_get(model, &iter, CHAT_USERS_NAME_COLUMN, &name, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4342
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4343 if (!strcmp(normalized_name, purple_normalize(conv->account, name))) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4344 gtk_list_store_set(GTK_LIST_STORE(model), &iter,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4345 CHAT_USERS_WEIGHT_COLUMN, is_buddy ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4346 g_free(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4347 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4348 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4349
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4350 f = gtk_tree_model_iter_next(model, &iter);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4351
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4352 g_free(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4353 } while (f != 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4354
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4355 g_free(normalized_name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4356
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4357 blist_node_aliased_cb((PurpleBlistNode *)buddy, NULL, conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4358 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4359
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4360 static void
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4361 buddy_added_cb(PurpleBuddy *buddy, PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4362 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4363 buddy_cb_common(buddy, conv, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4364 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4365
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4366 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4367 buddy_removed_cb(PurpleBuddy *buddy, PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4368 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4369 /* If there's another buddy for the same "dude" on the list, do nothing. */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4370 if (purple_find_buddy(buddy->account, buddy->name) != NULL)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4371 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4372
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4373 buddy_cb_common(buddy, conv, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4374 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4375
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4376 static void send_menu_cb(GtkWidget *widget, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4377 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4378 g_signal_emit_by_name(gtkconv->entry, "message_send");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4379 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4380
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4381 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4382 entry_popup_menu_cb(GtkIMHtml *imhtml, GtkMenu *menu, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4383 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4384 GtkWidget *menuitem;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4385 PidginConversation *gtkconv = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4386
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4387 g_return_if_fail(menu != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4388 g_return_if_fail(gtkconv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4389
15560
442128853bdb toolbar/menu icons. reduce the imhtmltoolbar spacing. more gaimstock pruning
Sean Egan <seanegan@gmail.com>
parents: 15557
diff changeset
4390 menuitem = pidgin_new_item_from_stock(NULL, _("_Send"), NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4391 G_CALLBACK(send_menu_cb), gtkconv,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4392 0, 0, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4393 if (gtk_text_buffer_get_char_count(imhtml->text_buffer) == 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4394 gtk_widget_set_sensitive(menuitem, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4395 gtk_menu_shell_insert(GTK_MENU_SHELL(menu), menuitem, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4396
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4397 menuitem = gtk_separator_menu_item_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4398 gtk_widget_show(menuitem);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4399 gtk_menu_shell_insert(GTK_MENU_SHELL(menu), menuitem, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4400 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4401
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4402 static void resize_imhtml_cb(PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4403 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4404 GtkTextBuffer *buffer;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4405 GtkTextIter iter;
20837
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4406 int wrapped_lines;
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4407 int lines;
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4408 GdkRectangle oneline;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4409 GtkRequisition sr;
20838
effa512ad24a fix the auto resize code for the showing formatting toolbar case, which
Ka-Hing Cheung <khc@hxbc.us>
parents: 20837
diff changeset
4410 int height, diff;
20837
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4411 int pad_top, pad_inside, pad_bottom;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4412
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4413 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4414
20837
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4415 wrapped_lines = 1;
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4416 gtk_text_buffer_get_start_iter(buffer, &iter);
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4417 gtk_text_view_get_iter_location(GTK_TEXT_VIEW(gtkconv->entry), &iter, &oneline);
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4418 while (gtk_text_view_forward_display_line(GTK_TEXT_VIEW(gtkconv->entry), &iter))
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4419 wrapped_lines++;
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4420
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4421 lines = gtk_text_buffer_get_line_count(buffer);
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4422
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4423 /* Show a maximum of 4 lines */
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4424 lines = MIN(lines, 4);
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4425 wrapped_lines = MIN(wrapped_lines, 4);
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4426
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4427 pad_top = gtk_text_view_get_pixels_above_lines(GTK_TEXT_VIEW(gtkconv->entry));
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4428 pad_bottom = gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(gtkconv->entry));
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4429 pad_inside = gtk_text_view_get_pixels_inside_wrap(GTK_TEXT_VIEW(gtkconv->entry));
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4430
21818
1aba82112cf2 Let's try MAX(lines, 2) as suggested by Sean. I've been using (lines + 1)
Stu Tomlinson <stu@nosnilmot.com>
parents: 21786
diff changeset
4431 height = (oneline.height + pad_top + pad_bottom) * MAX(lines, 2);
20837
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4432 height += (oneline.height + pad_inside) * (wrapped_lines - lines);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4433
18631
462737382c64 Better imhtml auto-growing. Fixes #214
Sean Egan <seanegan@gmail.com>
parents: 18625
diff changeset
4434 gtkconv->auto_resize = TRUE;
20837
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4435 g_idle_add(reset_auto_resize_cb, gtkconv);
20838
effa512ad24a fix the auto resize code for the showing formatting toolbar case, which
Ka-Hing Cheung <khc@hxbc.us>
parents: 20837
diff changeset
4436
20839
83b662c458de uses the entry's allocated height instead of requested height, works around
Ka-Hing Cheung <khc@hxbc.us>
parents: 20838
diff changeset
4437 diff = height - gtkconv->entry->allocation.height;
20838
effa512ad24a fix the auto resize code for the showing formatting toolbar case, which
Ka-Hing Cheung <khc@hxbc.us>
parents: 20837
diff changeset
4438
effa512ad24a fix the auto resize code for the showing formatting toolbar case, which
Ka-Hing Cheung <khc@hxbc.us>
parents: 20837
diff changeset
4439 if (diff > 0) {
effa512ad24a fix the auto resize code for the showing formatting toolbar case, which
Ka-Hing Cheung <khc@hxbc.us>
parents: 20837
diff changeset
4440 gtk_widget_size_request(gtkconv->lower_hbox, &sr);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4441 gtkconv->entry_growing = TRUE;
20842
9da2ac85ce81 compute the new size by adding the difference to the actual allocated size
Ka-Hing Cheung <khc@hxbc.us>
parents: 20839
diff changeset
4442
9da2ac85ce81 compute the new size by adding the difference to the actual allocated size
Ka-Hing Cheung <khc@hxbc.us>
parents: 20839
diff changeset
4443 /* uncomment this to auto resize even after the user manually
9da2ac85ce81 compute the new size by adding the difference to the actual allocated size
Ka-Hing Cheung <khc@hxbc.us>
parents: 20839
diff changeset
4444 resizes
9da2ac85ce81 compute the new size by adding the difference to the actual allocated size
Ka-Hing Cheung <khc@hxbc.us>
parents: 20839
diff changeset
4445 gtk_paned_set_position(GTK_PANED(gtkconv->lower_hbox->parent->parent),
9da2ac85ce81 compute the new size by adding the difference to the actual allocated size
Ka-Hing Cheung <khc@hxbc.us>
parents: 20839
diff changeset
4446 -1);
9da2ac85ce81 compute the new size by adding the difference to the actual allocated size
Ka-Hing Cheung <khc@hxbc.us>
parents: 20839
diff changeset
4447 */
9da2ac85ce81 compute the new size by adding the difference to the actual allocated size
Ka-Hing Cheung <khc@hxbc.us>
parents: 20839
diff changeset
4448 gtk_widget_set_size_request(gtkconv->lower_hbox, -1,
9da2ac85ce81 compute the new size by adding the difference to the actual allocated size
Ka-Hing Cheung <khc@hxbc.us>
parents: 20839
diff changeset
4449 diff + gtkconv->lower_hbox->allocation.height);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4450 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4451 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4452
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4453 static void
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4454 setup_chat_topic(PidginConversation *gtkconv, GtkWidget *vbox)
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4455 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4456 PurpleConversation *conv = gtkconv->active_conv;
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4457 PurpleConnection *gc = purple_conversation_get_gc(conv);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4458 PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4459 if (prpl_info->options & OPT_PROTO_CHAT_TOPIC)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4460 {
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4461 GtkWidget *hbox, *label;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4462 PidginChatPane *gtkchat = gtkconv->u.chat;
21821
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4463
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
4464 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4465 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4466
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4467 label = gtk_label_new(_("Topic:"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4468 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4469
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4470 gtkchat->topic_text = gtk_entry_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4471
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4472 if(prpl_info->set_chat_topic == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4473 gtk_editable_set_editable(GTK_EDITABLE(gtkchat->topic_text), FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4474 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4475 g_signal_connect(GTK_OBJECT(gtkchat->topic_text), "activate",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4476 G_CALLBACK(topic_callback), gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4477 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4478
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4479 gtk_box_pack_start(GTK_BOX(hbox), gtkchat->topic_text, TRUE, TRUE, 0);
17820
192a86dfade8 Handle key presses in the topic entry area in chats so Alt-# etc. works for
Stu Tomlinson <stu@nosnilmot.com>
parents: 17776
diff changeset
4480 g_signal_connect(G_OBJECT(gtkchat->topic_text), "key_press_event",
192a86dfade8 Handle key presses in the topic entry area in chats so Alt-# etc. works for
Stu Tomlinson <stu@nosnilmot.com>
parents: 17776
diff changeset
4481 G_CALLBACK(entry_key_press_cb), gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4482 }
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4483 }
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4484
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4485 static void
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4486 setup_chat_userlist(PidginConversation *gtkconv, GtkWidget *hpaned)
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4487 {
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4488 PidginChatPane *gtkchat = gtkconv->u.chat;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4489 GtkWidget *lbox, *sw, *list;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4490 GtkListStore *ls;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4491 GtkCellRenderer *rend;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4492 GtkTreeViewColumn *col;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4493 int ul_width;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4494 void *blist_handle = purple_blist_get_handle();
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4495 PurpleConversation *conv = gtkconv->active_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4496
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4497 /* Build the right pane. */
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
4498 lbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4499 gtk_paned_pack2(GTK_PANED(hpaned), lbox, FALSE, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4500 gtk_widget_show(lbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4501
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4502 /* Setup the label telling how many people are in the room. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4503 gtkchat->count = gtk_label_new(_("0 people in room"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4504 gtk_box_pack_start(GTK_BOX(lbox), gtkchat->count, FALSE, FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4505 gtk_widget_show(gtkchat->count);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4506
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4507 /* Setup the list of users. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4508 sw = gtk_scrolled_window_new(NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4509 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4510 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4511 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4512 gtk_box_pack_start(GTK_BOX(lbox), sw, TRUE, TRUE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4513 gtk_widget_show(sw);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4514
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4515 ls = gtk_list_store_new(CHAT_USERS_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4516 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4517 GDK_TYPE_COLOR, G_TYPE_INT);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4518 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(ls), CHAT_USERS_ALIAS_KEY_COLUMN,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4519 sort_chat_users, NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4520
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4521 list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ls));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4522
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4523 rend = gtk_cell_renderer_pixbuf_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4524
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4525 col = gtk_tree_view_column_new_with_attributes(NULL, rend,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4526 "pixbuf", CHAT_USERS_ICON_COLUMN, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4527 gtk_tree_view_column_set_sizing(col, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4528 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col);
17056
413c957e7c44 Hack to prevent a completely collapsed user list from coming ack with a 1-pixel width. Fixes #624.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17002
diff changeset
4529 ul_width = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/chat/userlist_width");
413c957e7c44 Hack to prevent a completely collapsed user list from coming ack with a 1-pixel width. Fixes #624.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17002
diff changeset
4530 gtk_widget_set_size_request(lbox, ul_width, -1);
413c957e7c44 Hack to prevent a completely collapsed user list from coming ack with a 1-pixel width. Fixes #624.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17002
diff changeset
4531
413c957e7c44 Hack to prevent a completely collapsed user list from coming ack with a 1-pixel width. Fixes #624.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17002
diff changeset
4532 /* Hack to prevent completely collapsed userlist coming back with a 1 pixel width.
413c957e7c44 Hack to prevent a completely collapsed user list from coming ack with a 1-pixel width. Fixes #624.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17002
diff changeset
4533 * I would have liked to use the GtkPaned "max-position", but for some reason that didn't work */
413c957e7c44 Hack to prevent a completely collapsed user list from coming ack with a 1-pixel width. Fixes #624.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17002
diff changeset
4534 if (ul_width == 0)
413c957e7c44 Hack to prevent a completely collapsed user list from coming ack with a 1-pixel width. Fixes #624.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17002
diff changeset
4535 gtk_paned_set_position(GTK_PANED(hpaned), 999999);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4536
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4537 g_signal_connect(G_OBJECT(list), "button_press_event",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4538 G_CALLBACK(right_click_chat_cb), gtkconv);
19588
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4539 g_signal_connect(G_OBJECT(list), "motion-notify-event",
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4540 G_CALLBACK(pidgin_userlist_motion_cb), gtkconv);
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4541 g_signal_connect(G_OBJECT(list), "leave-notify-event",
20199
56a6d78c6613 applied changes from ff2a2004566a5c90047811f96ab84ebec8402d14
Richard Laager <rlaager@wiktel.com>
parents: 20190
diff changeset
4542 G_CALLBACK(pidgin_conv_leave_cb), gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4543 g_signal_connect(G_OBJECT(list), "popup-menu",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4544 G_CALLBACK(gtkconv_chat_popup_menu_cb), gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4545 g_signal_connect(G_OBJECT(lbox), "size-allocate", G_CALLBACK(lbox_size_allocate_cb), gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4546
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4547 rend = gtk_cell_renderer_text_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4548 g_object_set(rend,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4549 "foreground-set", TRUE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4550 "weight-set", TRUE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4551 NULL);
19234
aafa9b36344e Double-click infopane to alias or change topic. Also, show alias instead of screenname in infopane
Sean Egan <seanegan@gmail.com>
parents: 19231
diff changeset
4552 g_object_set(G_OBJECT(rend), "editable", TRUE, NULL);
aafa9b36344e Double-click infopane to alias or change topic. Also, show alias instead of screenname in infopane
Sean Egan <seanegan@gmail.com>
parents: 19231
diff changeset
4553
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4554 col = gtk_tree_view_column_new_with_attributes(NULL, rend,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4555 "text", CHAT_USERS_ALIAS_COLUMN,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4556 "foreground-gdk", CHAT_USERS_COLOR_COLUMN,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4557 "weight", CHAT_USERS_WEIGHT_COLUMN,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4558 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4559
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4560 purple_signal_connect(blist_handle, "buddy-added",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4561 gtkchat, PURPLE_CALLBACK(buddy_added_cb), conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4562 purple_signal_connect(blist_handle, "buddy-removed",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4563 gtkchat, PURPLE_CALLBACK(buddy_removed_cb), conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4564 purple_signal_connect(blist_handle, "blist-node-aliased",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4565 gtkchat, PURPLE_CALLBACK(blist_node_aliased_cb), conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4566
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4567 #if GTK_CHECK_VERSION(2,6,0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4568 gtk_tree_view_column_set_expand(col, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4569 g_object_set(rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4570 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4571
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4572 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4573
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4574 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(list), FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4575 gtk_widget_show(list);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4576
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4577 gtkchat->list = list;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4578
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4579 gtk_container_add(GTK_CONTAINER(sw), list);
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4580 }
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4581
19227
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4582 /* Stuff used to display tooltips on the infopane */
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4583 static struct {
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4584 int timeout;
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4585 PidginConversation *gtkconv; /* This is the Pidgin conversation that
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4586 triggered the tooltip */
19588
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4587 int userlistx;
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4588 int userlisty;
19227
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4589 } tooltip;
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4590
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4591 static void
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4592 reset_tooltip()
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4593 {
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4594 if (tooltip.timeout != 0) {
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4595 g_source_remove(tooltip.timeout);
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4596 tooltip.timeout = 0;
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4597 }
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4598 tooltip.gtkconv = NULL;
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4599 }
18671
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4600
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4601 static gboolean
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4602 pidgin_conv_tooltip_timeout(PidginConversation *gtkconv)
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4603 {
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4604 PurpleBlistNode *node = NULL;
19227
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4605 PurpleConversation *conv;
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4606
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4607 g_return_val_if_fail (tooltip.gtkconv == gtkconv, FALSE);
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4608
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4609 conv = gtkconv->active_conv;
19226
a0d45fa8ecfc De-seaneganify some of the indentation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19223
diff changeset
4610 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) {
a0d45fa8ecfc De-seaneganify some of the indentation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19223
diff changeset
4611 node = (PurpleBlistNode*)(purple_blist_find_chat(conv->account, conv->name));
21821
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4612 #if 0
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4613 /* Using the transient blist nodes to show the tooltip doesn't quite work yet. */
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4614 if (!node)
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4615 node = g_object_get_data(G_OBJECT(gtkconv->imhtml), "transient_chat");
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4616 #endif
18671
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4617 } else {
19226
a0d45fa8ecfc De-seaneganify some of the indentation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19223
diff changeset
4618 node = (PurpleBlistNode*)(purple_find_buddy(conv->account, conv->name));
21821
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4619 #if 0
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4620 if (!node)
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4621 node = g_object_get_data(G_OBJECT(gtkconv->imhtml), "transient_buddy");
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4622 #endif
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4623 }
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4624
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4625 if (node)
18671
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4626 pidgin_blist_draw_tooltip(node, gtkconv->infopane);
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4627 return FALSE;
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4628 }
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4629
21821
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4630 static void
18671
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4631 pidgin_conv_leave_cb (GtkWidget *w, GdkEventCrossing *e, PidginConversation *gtkconv)
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4632 {
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4633 pidgin_blist_tooltip_destroy();
19227
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4634 reset_tooltip();
18671
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4635 }
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4636
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4637 static gboolean
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4638 pidgin_conv_motion_cb (GtkWidget *infopane, GdkEventMotion *event, PidginConversation *gtkconv)
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4639 {
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4640 int delay = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/tooltip_delay");
19655
1729367f0a4f Fix a crash when hovering over a buddy in the chat userlist and the account is disconnected.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19620
diff changeset
4641
18671
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4642 pidgin_blist_tooltip_destroy();
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4643 if (delay == 0)
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4644 return FALSE;
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4645
19655
1729367f0a4f Fix a crash when hovering over a buddy in the chat userlist and the account is disconnected.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19620
diff changeset
4646 if (tooltip.timeout != 0)
19227
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4647 g_source_remove(tooltip.timeout);
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4648
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4649 tooltip.timeout = g_timeout_add(delay, (GSourceFunc)pidgin_conv_tooltip_timeout, gtkconv);
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4650 tooltip.gtkconv = gtkconv;
18671
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4651 return FALSE;
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4652 }
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4653
19588
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4654 static gboolean
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4655 pidgin_userlist_tooltip_timeout(PidginConversation *gtkconv)
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4656 {
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4657 PurplePluginProtocolInfo *prpl_info;
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4658 PurpleConversation *conv = gtkconv->active_conv;
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4659 PidginChatPane *gtkchat;
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4660 PurpleBlistNode *node = NULL;
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4661 PurpleAccount *account;
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4662 GtkTreePath *path;
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4663 GtkTreeIter iter;
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4664 GtkTreeModel *model;
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4665 GtkTreeViewColumn *column;
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4666 gchar *who;
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4667 int x, y;
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4668
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4669 gtkchat = gtkconv->u.chat;
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4670 account = purple_conversation_get_account(conv);
19655
1729367f0a4f Fix a crash when hovering over a buddy in the chat userlist and the account is disconnected.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19620
diff changeset
4671
1729367f0a4f Fix a crash when hovering over a buddy in the chat userlist and the account is disconnected.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19620
diff changeset
4672 if (account->gc == NULL)
1729367f0a4f Fix a crash when hovering over a buddy in the chat userlist and the account is disconnected.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19620
diff changeset
4673 return FALSE;
1729367f0a4f Fix a crash when hovering over a buddy in the chat userlist and the account is disconnected.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19620
diff changeset
4674
1729367f0a4f Fix a crash when hovering over a buddy in the chat userlist and the account is disconnected.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19620
diff changeset
4675 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(account->gc->prpl);
19588
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4676
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4677 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list));
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4678
20199
56a6d78c6613 applied changes from ff2a2004566a5c90047811f96ab84ebec8402d14
Richard Laager <rlaager@wiktel.com>
parents: 20190
diff changeset
4679 if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(gtkchat->list),
56a6d78c6613 applied changes from ff2a2004566a5c90047811f96ab84ebec8402d14
Richard Laager <rlaager@wiktel.com>
parents: 20190
diff changeset
4680 tooltip.userlistx, tooltip.userlisty, &path, &column, &x, &y))
19588
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4681 return FALSE;
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4682
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4683 gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, path);
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4684 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &who, -1);
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4685
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4686 node = (PurpleBlistNode*)(purple_find_buddy(conv->account, who));
19655
1729367f0a4f Fix a crash when hovering over a buddy in the chat userlist and the account is disconnected.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19620
diff changeset
4687 if (node && prpl_info && (prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME))
19588
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4688 pidgin_blist_draw_tooltip(node, gtkconv->infopane);
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4689
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4690 g_free(who);
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4691 gtk_tree_path_free(path);
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4692
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4693
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4694 return FALSE;
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4695 }
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4696
19655
1729367f0a4f Fix a crash when hovering over a buddy in the chat userlist and the account is disconnected.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19620
diff changeset
4697 static gboolean
19588
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4698 pidgin_userlist_motion_cb (GtkWidget *w, GdkEventMotion *event, PidginConversation *gtkconv)
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4699 {
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4700 PurpleConversation *conv;
19655
1729367f0a4f Fix a crash when hovering over a buddy in the chat userlist and the account is disconnected.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19620
diff changeset
4701 PurpleAccount *account;
19588
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4702 int delay = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/tooltip_delay");
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4703
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4704 pidgin_blist_tooltip_destroy();
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4705 if (delay == 0)
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4706 return FALSE;
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4707
19655
1729367f0a4f Fix a crash when hovering over a buddy in the chat userlist and the account is disconnected.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19620
diff changeset
4708 if (tooltip.timeout != 0)
19588
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4709 g_source_remove(tooltip.timeout);
19655
1729367f0a4f Fix a crash when hovering over a buddy in the chat userlist and the account is disconnected.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19620
diff changeset
4710 tooltip.timeout = 0;
1729367f0a4f Fix a crash when hovering over a buddy in the chat userlist and the account is disconnected.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19620
diff changeset
4711
19588
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4712 conv = gtkconv->active_conv;
19655
1729367f0a4f Fix a crash when hovering over a buddy in the chat userlist and the account is disconnected.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19620
diff changeset
4713 account = purple_conversation_get_account(conv);
1729367f0a4f Fix a crash when hovering over a buddy in the chat userlist and the account is disconnected.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19620
diff changeset
4714
1729367f0a4f Fix a crash when hovering over a buddy in the chat userlist and the account is disconnected.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19620
diff changeset
4715 if (account->gc == NULL)
1729367f0a4f Fix a crash when hovering over a buddy in the chat userlist and the account is disconnected.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19620
diff changeset
4716 return FALSE;
19588
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4717
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4718 tooltip.timeout = g_timeout_add(delay, (GSourceFunc)pidgin_userlist_tooltip_timeout, gtkconv);
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4719 tooltip.gtkconv = gtkconv;
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4720 tooltip.userlistx = event->x;
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4721 tooltip.userlisty = event->y;
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4722
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4723 return FALSE;
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4724 }
7a5c4381e4dd Tooltips on chat userlist. Fixes #2815. Thanks fmoo
Sean Egan <seanegan@gmail.com>
parents: 19587
diff changeset
4725
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4726 static GtkWidget *
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4727 setup_common_pane(PidginConversation *gtkconv)
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4728 {
18227
cbc89a49e43b Treat infopanes just like tabs for purposes of drag-and-drop. Then, don't show a tab for windows with only one tab, as the infopane serves the purpose better
Sean Egan <seanegan@gmail.com>
parents: 18218
diff changeset
4729 GtkWidget *paned, *vbox, *frame, *imhtml_sw, *event_box;
18181
a8c701d877aa Start work on blist pane in conversation. Looks like: http://pidgin.im/~seanegan/infopane.png Certainly much to be done yet.
Sean Egan <seanegan@gmail.com>
parents: 18167
diff changeset
4730 GtkCellRenderer *rend;
a8c701d877aa Start work on blist pane in conversation. Looks like: http://pidgin.im/~seanegan/infopane.png Certainly much to be done yet.
Sean Egan <seanegan@gmail.com>
parents: 18167
diff changeset
4731 GtkTreePath *path;
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4732 PurpleConversation *conv = gtkconv->active_conv;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4733 gboolean chat = (conv->type == PURPLE_CONV_TYPE_CHAT);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4734 GtkPolicyType imhtml_sw_hscroll;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4735
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4736 paned = gtk_vpaned_new();
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4737 gtk_widget_show(paned);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4738
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4739 /* Setup the top part of the pane */
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4740 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4741 gtk_paned_pack1(GTK_PANED(paned), vbox, TRUE, TRUE);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4742 gtk_widget_show(vbox);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4743
18181
a8c701d877aa Start work on blist pane in conversation. Looks like: http://pidgin.im/~seanegan/infopane.png Certainly much to be done yet.
Sean Egan <seanegan@gmail.com>
parents: 18167
diff changeset
4744 /* Setup the info pane */
18227
cbc89a49e43b Treat infopanes just like tabs for purposes of drag-and-drop. Then, don't show a tab for windows with only one tab, as the infopane serves the purpose better
Sean Egan <seanegan@gmail.com>
parents: 18218
diff changeset
4745 event_box = gtk_event_box_new();
18632
e47ff6610fc7 Make eventbox input only in infopane. Thanks fmoo.
Sean Egan <seanegan@gmail.com>
parents: 18631
diff changeset
4746 #if GTK_CHECK_VERSION(2,4,0)
e47ff6610fc7 Make eventbox input only in infopane. Thanks fmoo.
Sean Egan <seanegan@gmail.com>
parents: 18631
diff changeset
4747 gtk_event_box_set_visible_window(GTK_EVENT_BOX(event_box), FALSE);
e47ff6610fc7 Make eventbox input only in infopane. Thanks fmoo.
Sean Egan <seanegan@gmail.com>
parents: 18631
diff changeset
4748 #endif
18227
cbc89a49e43b Treat infopanes just like tabs for purposes of drag-and-drop. Then, don't show a tab for windows with only one tab, as the infopane serves the purpose better
Sean Egan <seanegan@gmail.com>
parents: 18218
diff changeset
4749 gtk_widget_show(event_box);
18181
a8c701d877aa Start work on blist pane in conversation. Looks like: http://pidgin.im/~seanegan/infopane.png Certainly much to be done yet.
Sean Egan <seanegan@gmail.com>
parents: 18167
diff changeset
4750 gtkconv->infopane_hbox = gtk_hbox_new(FALSE, 0);
18227
cbc89a49e43b Treat infopanes just like tabs for purposes of drag-and-drop. Then, don't show a tab for windows with only one tab, as the infopane serves the purpose better
Sean Egan <seanegan@gmail.com>
parents: 18218
diff changeset
4751 gtk_box_pack_start(GTK_BOX(vbox), event_box, FALSE, FALSE, 0);
cbc89a49e43b Treat infopanes just like tabs for purposes of drag-and-drop. Then, don't show a tab for windows with only one tab, as the infopane serves the purpose better
Sean Egan <seanegan@gmail.com>
parents: 18218
diff changeset
4752 gtk_container_add(GTK_CONTAINER(event_box), gtkconv->infopane_hbox);
18181
a8c701d877aa Start work on blist pane in conversation. Looks like: http://pidgin.im/~seanegan/infopane.png Certainly much to be done yet.
Sean Egan <seanegan@gmail.com>
parents: 18167
diff changeset
4753 gtk_widget_show(gtkconv->infopane_hbox);
18227
cbc89a49e43b Treat infopanes just like tabs for purposes of drag-and-drop. Then, don't show a tab for windows with only one tab, as the infopane serves the purpose better
Sean Egan <seanegan@gmail.com>
parents: 18218
diff changeset
4754 gtk_widget_add_events(event_box,
18671
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4755 GDK_POINTER_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK);
19655
1729367f0a4f Fix a crash when hovering over a buddy in the chat userlist and the account is disconnected.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19620
diff changeset
4756 g_signal_connect(G_OBJECT(event_box), "button-press-event",
18227
cbc89a49e43b Treat infopanes just like tabs for purposes of drag-and-drop. Then, don't show a tab for windows with only one tab, as the infopane serves the purpose better
Sean Egan <seanegan@gmail.com>
parents: 18218
diff changeset
4757 G_CALLBACK(infopane_press_cb), gtkconv);
cbc89a49e43b Treat infopanes just like tabs for purposes of drag-and-drop. Then, don't show a tab for windows with only one tab, as the infopane serves the purpose better
Sean Egan <seanegan@gmail.com>
parents: 18218
diff changeset
4758
19226
a0d45fa8ecfc De-seaneganify some of the indentation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19223
diff changeset
4759 g_signal_connect(G_OBJECT(event_box), "motion-notify-event",
a0d45fa8ecfc De-seaneganify some of the indentation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19223
diff changeset
4760 G_CALLBACK(pidgin_conv_motion_cb), gtkconv);
a0d45fa8ecfc De-seaneganify some of the indentation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19223
diff changeset
4761 g_signal_connect(G_OBJECT(event_box), "leave-notify-event",
a0d45fa8ecfc De-seaneganify some of the indentation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19223
diff changeset
4762 G_CALLBACK(pidgin_conv_leave_cb), gtkconv);
18181
a8c701d877aa Start work on blist pane in conversation. Looks like: http://pidgin.im/~seanegan/infopane.png Certainly much to be done yet.
Sean Egan <seanegan@gmail.com>
parents: 18167
diff changeset
4763
a8c701d877aa Start work on blist pane in conversation. Looks like: http://pidgin.im/~seanegan/infopane.png Certainly much to be done yet.
Sean Egan <seanegan@gmail.com>
parents: 18167
diff changeset
4764 gtkconv->infopane = gtk_cell_view_new();
19474
74befdcd0454 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@gmail.com>
parents: 19468
diff changeset
4765 gtkconv->infopane_model = gtk_list_store_new(CONV_NUM_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, GDK_TYPE_PIXBUF, GDK_TYPE_PIXBUF);
18214
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
4766 gtk_cell_view_set_model(GTK_CELL_VIEW(gtkconv->infopane),
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
4767 GTK_TREE_MODEL(gtkconv->infopane_model));
18181
a8c701d877aa Start work on blist pane in conversation. Looks like: http://pidgin.im/~seanegan/infopane.png Certainly much to be done yet.
Sean Egan <seanegan@gmail.com>
parents: 18167
diff changeset
4768 gtk_list_store_append(gtkconv->infopane_model, &(gtkconv->infopane_iter));
a8c701d877aa Start work on blist pane in conversation. Looks like: http://pidgin.im/~seanegan/infopane.png Certainly much to be done yet.
Sean Egan <seanegan@gmail.com>
parents: 18167
diff changeset
4769 gtk_box_pack_start(GTK_BOX(gtkconv->infopane_hbox), gtkconv->infopane, TRUE, TRUE, 0);
18218
571e0ca28d6c Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18215
diff changeset
4770 path = gtk_tree_path_new_from_string("0");
571e0ca28d6c Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18215
diff changeset
4771 gtk_cell_view_set_displayed_row(GTK_CELL_VIEW(gtkconv->infopane), path);
571e0ca28d6c Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18215
diff changeset
4772 gtk_tree_path_free(path);
19306
16cad7ba399c Set size request on infopane's hbox instead of hbox itself. This way, when we hide the hbox to edit, the pane remains 32px tall
Sean Egan <seanegan@gmail.com>
parents: 19293
diff changeset
4773 gtk_widget_set_size_request(gtkconv->infopane_hbox, -1, 32);
18181
a8c701d877aa Start work on blist pane in conversation. Looks like: http://pidgin.im/~seanegan/infopane.png Certainly much to be done yet.
Sean Egan <seanegan@gmail.com>
parents: 18167
diff changeset
4774 gtk_widget_show(gtkconv->infopane);
a8c701d877aa Start work on blist pane in conversation. Looks like: http://pidgin.im/~seanegan/infopane.png Certainly much to be done yet.
Sean Egan <seanegan@gmail.com>
parents: 18167
diff changeset
4775
a8c701d877aa Start work on blist pane in conversation. Looks like: http://pidgin.im/~seanegan/infopane.png Certainly much to be done yet.
Sean Egan <seanegan@gmail.com>
parents: 18167
diff changeset
4776 rend = gtk_cell_renderer_pixbuf_new();
a8c701d877aa Start work on blist pane in conversation. Looks like: http://pidgin.im/~seanegan/infopane.png Certainly much to be done yet.
Sean Egan <seanegan@gmail.com>
parents: 18167
diff changeset
4777 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(gtkconv->infopane), rend, FALSE);
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
4778 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(gtkconv->infopane), rend, "pixbuf", CONV_ICON_COLUMN, NULL);
18218
571e0ca28d6c Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18215
diff changeset
4779 g_object_set(rend, "xalign", 0.0, "xpad", 6, "ypad", 0, NULL);
18181
a8c701d877aa Start work on blist pane in conversation. Looks like: http://pidgin.im/~seanegan/infopane.png Certainly much to be done yet.
Sean Egan <seanegan@gmail.com>
parents: 18167
diff changeset
4780
a8c701d877aa Start work on blist pane in conversation. Looks like: http://pidgin.im/~seanegan/infopane.png Certainly much to be done yet.
Sean Egan <seanegan@gmail.com>
parents: 18167
diff changeset
4781 rend = gtk_cell_renderer_text_new();
a8c701d877aa Start work on blist pane in conversation. Looks like: http://pidgin.im/~seanegan/infopane.png Certainly much to be done yet.
Sean Egan <seanegan@gmail.com>
parents: 18167
diff changeset
4782 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(gtkconv->infopane), rend, TRUE);
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
4783 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(gtkconv->infopane), rend, "markup", CONV_TEXT_COLUMN, NULL);
18218
571e0ca28d6c Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18215
diff changeset
4784 g_object_set(rend, "ypad", 0, "yalign", 0.5, NULL);
18181
a8c701d877aa Start work on blist pane in conversation. Looks like: http://pidgin.im/~seanegan/infopane.png Certainly much to be done yet.
Sean Egan <seanegan@gmail.com>
parents: 18167
diff changeset
4785
19478
b2578b2d4bc4 Remove X11 specifics from configure.ac. Allows to build against native, non-X11 Quartz
Sean Egan <seanegan@gmail.com>
parents: 19474
diff changeset
4786 #if GTK_CHECK_VERSION(2, 6, 0)
b2578b2d4bc4 Remove X11 specifics from configure.ac. Allows to build against native, non-X11 Quartz
Sean Egan <seanegan@gmail.com>
parents: 19474
diff changeset
4787 g_object_set(rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
b2578b2d4bc4 Remove X11 specifics from configure.ac. Allows to build against native, non-X11 Quartz
Sean Egan <seanegan@gmail.com>
parents: 19474
diff changeset
4788 #endif
b2578b2d4bc4 Remove X11 specifics from configure.ac. Allows to build against native, non-X11 Quartz
Sean Egan <seanegan@gmail.com>
parents: 19474
diff changeset
4789
19474
74befdcd0454 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@gmail.com>
parents: 19468
diff changeset
4790 rend = gtk_cell_renderer_pixbuf_new();
74befdcd0454 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@gmail.com>
parents: 19468
diff changeset
4791 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(gtkconv->infopane), rend, FALSE);
74befdcd0454 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@gmail.com>
parents: 19468
diff changeset
4792 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(gtkconv->infopane), rend, "pixbuf", CONV_PROTOCOL_ICON_COLUMN, NULL);
74befdcd0454 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@gmail.com>
parents: 19468
diff changeset
4793 g_object_set(rend, "xalign", 0.0, "xpad", 3, "ypad", 0, NULL);
74befdcd0454 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@gmail.com>
parents: 19468
diff changeset
4794
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
4795 rend = gtk_cell_renderer_pixbuf_new();
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
4796 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(gtkconv->infopane), rend, FALSE);
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
4797 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(gtkconv->infopane), rend, "pixbuf", CONV_EMBLEM_COLUMN, NULL);
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
4798 g_object_set(rend, "xalign", 0.0, "xpad", 6, "ypad", 0, NULL);
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
4799
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4800 /* Setup the gtkimhtml widget */
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4801 frame = pidgin_create_imhtml(FALSE, &gtkconv->imhtml, NULL, &imhtml_sw);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4802 if (chat) {
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4803 GtkWidget *hpaned;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4804
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4805 /* Add the topic */
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4806 setup_chat_topic(gtkconv, vbox);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4807
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4808 /* Add the gtkimhtml frame */
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4809 hpaned = gtk_hpaned_new();
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4810 gtk_box_pack_start(GTK_BOX(vbox), hpaned, TRUE, TRUE, 0);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4811 gtk_widget_show(hpaned);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4812 gtk_paned_pack1(GTK_PANED(hpaned), frame, TRUE, TRUE);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4813
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4814 /* Now add the userlist */
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4815 setup_chat_userlist(gtkconv, hpaned);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4816 } else {
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4817 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4818 }
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4819 gtk_widget_show(frame);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4820
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4821 gtk_widget_set_name(gtkconv->imhtml, "pidgin_conv_imhtml");
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4822 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml),TRUE);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4823
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4824 gtk_scrolled_window_get_policy(GTK_SCROLLED_WINDOW(imhtml_sw),
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4825 &imhtml_sw_hscroll, NULL);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4826 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(imhtml_sw),
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4827 imhtml_sw_hscroll, GTK_POLICY_ALWAYS);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4828
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4829 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event",
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4830 G_CALLBACK(entry_stop_rclick_cb), NULL);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4831 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event",
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4832 G_CALLBACK(refocus_entry_cb), gtkconv);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4833 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event",
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4834 G_CALLBACK(refocus_entry_cb), gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4835
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4836 /* Setup the bottom half of the conversation window */
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
4837 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4838 gtk_paned_pack2(GTK_PANED(paned), vbox, FALSE, TRUE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4839 gtk_widget_show(vbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4840
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
4841 gtkconv->lower_hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4842 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->lower_hbox, TRUE, TRUE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4843 gtk_widget_show(gtkconv->lower_hbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4844
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
4845 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4846 gtk_box_pack_end(GTK_BOX(gtkconv->lower_hbox), vbox, TRUE, TRUE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4847 gtk_widget_show(vbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4848
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4849 /* Setup the toolbar, entry widget and all signals */
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4850 frame = pidgin_create_imhtml(TRUE, &gtkconv->entry, &gtkconv->toolbar, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4851 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4852 gtk_widget_show(frame);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4853
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
4854 gtk_widget_set_name(gtkconv->entry, "pidgin_conv_entry");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4855 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry),
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4856 purple_account_get_protocol_name(conv->account));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4857 gtk_widget_set_size_request(gtkconv->lower_hbox, -1,
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4858 chat ? purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/chat/entry_height") :
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4859 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/im/entry_height"));
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4860
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4861 g_signal_connect(G_OBJECT(gtkconv->entry), "populate-popup",
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4862 G_CALLBACK(entry_popup_menu_cb), gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4863 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4864 G_CALLBACK(entry_key_press_cb), gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4865 g_signal_connect_after(G_OBJECT(gtkconv->entry), "message_send",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4866 G_CALLBACK(send_cb), gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4867 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4868 G_CALLBACK(entry_stop_rclick_cb), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4869 g_signal_connect(G_OBJECT(gtkconv->lower_hbox), "size-allocate",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4870 G_CALLBACK(size_allocate_cb), gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4871
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4872 gtkconv->entry_buffer =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4873 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4874 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4875
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4876 if (!chat) {
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4877 /* For sending typing notifications for IMs */
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4878 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "insert_text",
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4879 G_CALLBACK(insert_text_cb), gtkconv);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4880 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "delete_range",
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4881 G_CALLBACK(delete_text_cb), gtkconv);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4882 gtkconv->u.im->typing_timer = 0;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4883 gtkconv->u.im->animate = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/im/animate_buddy_icons");
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4884 gtkconv->u.im->show_icon = TRUE;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4885 }
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4886
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4887 g_signal_connect_swapped(G_OBJECT(gtkconv->entry_buffer), "changed",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4888 G_CALLBACK(resize_imhtml_cb), gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4889
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4890 default_formatize(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4891 g_signal_connect_after(G_OBJECT(gtkconv->entry), "format_function_clear",
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4892 G_CALLBACK(clear_formatting_cb), gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4893 return paned;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4894 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4895
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4896 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4897 conv_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4898 GtkSelectionData *sd, guint info, guint t,
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4899 PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4900 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4901 PurpleConversation *conv = gtkconv->active_conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4902 PidginWindow *win = gtkconv->win;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4903 PurpleConversation *c;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4904 if (sd->target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4905 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4906 PurpleBlistNode *n = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4907 PurpleBuddy *b;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4908 PidginConversation *gtkconv = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4909
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4910 n = *(PurpleBlistNode **)sd->data;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4911
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4912 if (PURPLE_BLIST_NODE_IS_CONTACT(n))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4913 b = purple_contact_get_priority_buddy((PurpleContact*)n);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4914 else if (PURPLE_BLIST_NODE_IS_BUDDY(n))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4915 b = (PurpleBuddy*)n;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4916 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4917 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4918
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4919 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4920 * If we already have an open conversation with this buddy, then
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4921 * just move the conv to this window. Otherwise, create a new
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4922 * conv and add it to this window.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4923 */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4924 c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, b->name, b->account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4925 if (c != NULL) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4926 PidginWindow *oldwin;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4927 gtkconv = PIDGIN_CONVERSATION(c);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4928 oldwin = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4929 if (oldwin != win) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4930 pidgin_conv_window_remove_gtkconv(oldwin, gtkconv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4931 pidgin_conv_window_add_gtkconv(win, gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4932 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4933 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4934 c = purple_conversation_new(PURPLE_CONV_TYPE_IM, b->account, b->name);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4935 gtkconv = PIDGIN_CONVERSATION(c);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4936 if (gtkconv->win != win)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4937 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4938 pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4939 pidgin_conv_window_add_gtkconv(win, gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4940 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4941 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4942
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4943 /* Make this conversation the active conversation */
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4944 pidgin_conv_window_switch_gtkconv(win, gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4945
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4946 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4947 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4948 else if (sd->target == gdk_atom_intern("application/x-im-contact", FALSE))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4949 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4950 char *protocol = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4951 char *username = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4952 PurpleAccount *account;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4953 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4954
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4955 if (pidgin_parse_x_im_contact((const char *)sd->data, FALSE, &account,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4956 &protocol, &username, NULL))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4957 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4958 if (account == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4959 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4960 purple_notify_error(win, NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4961 _("You are not currently signed on with an account that "
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4962 "can add that buddy."), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4963 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4964 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4965 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4966 c = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, username);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4967 gtkconv = PIDGIN_CONVERSATION(c);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4968 if (gtkconv->win != win)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4969 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4970 pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4971 pidgin_conv_window_add_gtkconv(win, gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4972 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4973 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4974 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4975
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4976 g_free(username);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4977 g_free(protocol);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4978
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4979 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4980 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4981 else if (sd->target == gdk_atom_intern("text/uri-list", FALSE)) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4982 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4983 pidgin_dnd_file_manage(sd, purple_conversation_get_account(conv), purple_conversation_get_name(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4984 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4985 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4986 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4987 gtk_drag_finish(dc, FALSE, FALSE, t);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4988 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4989
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4990
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4991 static const GtkTargetEntry te[] =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4992 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4993 GTK_IMHTML_DND_TARGETS,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4994 {"PURPLE_BLIST_NODE", GTK_TARGET_SAME_APP, GTK_IMHTML_DRAG_NUM},
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4995 {"application/x-im-contact", 0, GTK_IMHTML_DRAG_NUM + 1}
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4996 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4997
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4998 static PidginConversation *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4999 pidgin_conv_find_gtkconv(PurpleConversation * conv)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5000 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5001 PurpleBuddy *bud = purple_find_buddy(conv->account, conv->name), *b;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5002 PurpleContact *c;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5003 PurpleBlistNode *cn;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5004
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5005 if (!bud)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5006 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5007
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5008 if (!(c = purple_buddy_get_contact(bud)))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5009 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5010
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5011 cn = (PurpleBlistNode *)c;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5012 for (b = (PurpleBuddy *)cn->child; b; b = (PurpleBuddy *) ((PurpleBlistNode *)b)->next) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5013 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5014 if ((conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, b->name, b->account))) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5015 if (conv->ui_data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5016 return conv->ui_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5017 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5018 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5019
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5020 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5021 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5022
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5023 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5024 buddy_update_cb(PurpleBlistNode *bnode, gpointer null)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5025 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5026 GList *list;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5027
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5028 g_return_if_fail(bnode);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5029 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(bnode));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5030
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5031 for (list = pidgin_conv_windows_get_list(); list; list = list->next)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5032 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5033 PidginWindow *win = list->data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5034 PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5035
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5036 if (purple_conversation_get_type(conv) != PURPLE_CONV_TYPE_IM)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5037 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5038
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
5039 pidgin_conv_update_fields(conv, PIDGIN_CONV_MENU);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5040 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5041 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5042
17111
b079dad9d569 Stop propagating a middle-click on the pane-handle to the notebook below.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17107
diff changeset
5043 static gboolean
b079dad9d569 Stop propagating a middle-click on the pane-handle to the notebook below.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17107
diff changeset
5044 ignore_middle_click(GtkWidget *widget, GdkEventButton *e, gpointer null)
b079dad9d569 Stop propagating a middle-click on the pane-handle to the notebook below.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17107
diff changeset
5045 {
b079dad9d569 Stop propagating a middle-click on the pane-handle to the notebook below.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17107
diff changeset
5046 /* A click on the pane is propagated to the notebook containing the pane.
b079dad9d569 Stop propagating a middle-click on the pane-handle to the notebook below.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17107
diff changeset
5047 * So if Stu accidentally aims high and middle clicks on the pane-handle,
b079dad9d569 Stop propagating a middle-click on the pane-handle to the notebook below.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17107
diff changeset
5048 * it causes a conversation tab to close. Let's stop that from happening.
b079dad9d569 Stop propagating a middle-click on the pane-handle to the notebook below.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17107
diff changeset
5049 */
b079dad9d569 Stop propagating a middle-click on the pane-handle to the notebook below.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17107
diff changeset
5050 if (e->button == 2 && e->type == GDK_BUTTON_PRESS)
b079dad9d569 Stop propagating a middle-click on the pane-handle to the notebook below.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17107
diff changeset
5051 return TRUE;
b079dad9d569 Stop propagating a middle-click on the pane-handle to the notebook below.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17107
diff changeset
5052 return FALSE;
b079dad9d569 Stop propagating a middle-click on the pane-handle to the notebook below.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17107
diff changeset
5053 }
b079dad9d569 Stop propagating a middle-click on the pane-handle to the notebook below.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17107
diff changeset
5054
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5055 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5056 * Conversation UI operations
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5057 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5058 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5059 private_gtkconv_new(PurpleConversation *conv, gboolean hidden)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5060 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5061 PidginConversation *gtkconv;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5062 PurpleConversationType conv_type = purple_conversation_get_type(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5063 GtkWidget *pane = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5064 GtkWidget *tab_cont;
19980
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
5065 PurpleBlistNode *convnode;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5066
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5067 if (conv_type == PURPLE_CONV_TYPE_IM && (gtkconv = pidgin_conv_find_gtkconv(conv))) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5068 conv->ui_data = gtkconv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5069 if (!g_list_find(gtkconv->convs, conv))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5070 gtkconv->convs = g_list_prepend(gtkconv->convs, conv);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
5071 pidgin_conv_switch_active_conversation(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5072 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5073 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5074
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5075 gtkconv = g_new0(PidginConversation, 1);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5076 conv->ui_data = gtkconv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5077 gtkconv->active_conv = conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5078 gtkconv->convs = g_list_prepend(gtkconv->convs, conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5079 gtkconv->send_history = g_list_append(NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5080
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5081 /* Setup some initial variables. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5082 gtkconv->tooltips = gtk_tooltips_new();
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
5083 gtkconv->unseen_state = PIDGIN_UNSEEN_NONE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5084 gtkconv->unseen_count = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5085
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5086 if (conv_type == PURPLE_CONV_TYPE_IM) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5087 gtkconv->u.im = g_malloc0(sizeof(PidginImPane));
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5088 } else if (conv_type == PURPLE_CONV_TYPE_CHAT) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5089 gtkconv->u.chat = g_malloc0(sizeof(PidginChatPane));
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
5090 }
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
5091 pane = setup_common_pane(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5092
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5093 gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->imhtml),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5094 gtk_imhtml_get_format_functions(GTK_IMHTML(gtkconv->imhtml)) | GTK_IMHTML_IMAGE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5095
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5096 if (pane == NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5097 if (conv_type == PURPLE_CONV_TYPE_CHAT)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5098 g_free(gtkconv->u.chat);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5099 else if (conv_type == PURPLE_CONV_TYPE_IM)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5100 g_free(gtkconv->u.im);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5101
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5102 g_free(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5103 conv->ui_data = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5104 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5105 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5106
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5107 /* Setup drag-and-drop */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5108 gtk_drag_dest_set(pane,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5109 GTK_DEST_DEFAULT_MOTION |
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5110 GTK_DEST_DEFAULT_DROP,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5111 te, sizeof(te) / sizeof(GtkTargetEntry),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5112 GDK_ACTION_COPY);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5113 gtk_drag_dest_set(pane,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5114 GTK_DEST_DEFAULT_MOTION |
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5115 GTK_DEST_DEFAULT_DROP,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5116 te, sizeof(te) / sizeof(GtkTargetEntry),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5117 GDK_ACTION_COPY);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5118 gtk_drag_dest_set(gtkconv->imhtml, 0,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5119 te, sizeof(te) / sizeof(GtkTargetEntry),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5120 GDK_ACTION_COPY);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5121
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5122 gtk_drag_dest_set(gtkconv->entry, 0,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5123 te, sizeof(te) / sizeof(GtkTargetEntry),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5124 GDK_ACTION_COPY);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5125
17111
b079dad9d569 Stop propagating a middle-click on the pane-handle to the notebook below.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17107
diff changeset
5126 g_signal_connect(G_OBJECT(pane), "button_press_event",
b079dad9d569 Stop propagating a middle-click on the pane-handle to the notebook below.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17107
diff changeset
5127 G_CALLBACK(ignore_middle_click), NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5128 g_signal_connect(G_OBJECT(pane), "drag_data_received",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5129 G_CALLBACK(conv_dnd_recv), gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5130 g_signal_connect(G_OBJECT(gtkconv->imhtml), "drag_data_received",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5131 G_CALLBACK(conv_dnd_recv), gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5132 g_signal_connect(G_OBJECT(gtkconv->entry), "drag_data_received",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5133 G_CALLBACK(conv_dnd_recv), gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5134
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5135 /* Setup the container for the tab. */
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
5136 gtkconv->tab_cont = tab_cont = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5137 g_object_set_data(G_OBJECT(tab_cont), "PidginConversation", gtkconv);
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
5138 gtk_container_set_border_width(GTK_CONTAINER(tab_cont), PIDGIN_HIG_BOX_SPACE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5139 gtk_container_add(GTK_CONTAINER(tab_cont), pane);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5140 gtk_widget_show(pane);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5141
19980
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
5142 convnode = get_conversation_blist_node(conv);
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
5143 if (convnode == NULL || !purple_blist_node_get_bool(convnode, "gtk-mute-sound"))
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
5144 gtkconv->make_sound = TRUE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5145
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
5146 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar"))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5147 gtk_widget_show(gtkconv->toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5148 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5149 gtk_widget_hide(gtkconv->toolbar);
21665
baa25b613999 Clean up warnings
Sean Egan <seanegan@gmail.com>
parents: 21664
diff changeset
5150 g_idle_add((GSourceFunc)resize_imhtml_cb, gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5151
18602
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
5152 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/im/show_buddy_icons"))
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
5153 gtk_widget_show(gtkconv->infopane_hbox);
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
5154 else
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
5155 gtk_widget_hide(gtkconv->infopane_hbox);
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
5156
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5157 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml),
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
5158 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_timestamps"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5159 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5160 purple_account_get_protocol_name(conv->account));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5161
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5162 g_signal_connect_swapped(G_OBJECT(pane), "focus",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5163 G_CALLBACK(gtk_widget_grab_focus),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5164 gtkconv->entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5165
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5166 if (hidden)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5167 pidgin_conv_window_add_gtkconv(hidden_convwin, gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5168 else
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
5169 pidgin_conv_placement_place(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5170
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5171 if (nick_colors == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5172 nbr_nick_colors = NUM_NICK_COLORS;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5173 nick_colors = generate_nick_colors(&nbr_nick_colors, gtk_widget_get_style(gtkconv->imhtml)->base[GTK_STATE_NORMAL]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5174 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5175 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5176
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5177 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5178 pidgin_conv_new_hidden(PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5179 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5180 private_gtkconv_new(conv, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5181 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5182
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5183 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5184 pidgin_conv_new(PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5185 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5186 private_gtkconv_new(conv, FALSE);
20796
f4001b1bf14a Emit the 'conversation-displayed' signal when a conversation is created, in addition to when it's reattached.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20740
diff changeset
5187 if (PIDGIN_IS_PIDGIN_CONVERSATION(conv))
f4001b1bf14a Emit the 'conversation-displayed' signal when a conversation is created, in addition to when it's reattached.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20740
diff changeset
5188 purple_signal_emit(pidgin_conversations_get_handle(),
f4001b1bf14a Emit the 'conversation-displayed' signal when a conversation is created, in addition to when it's reattached.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20740
diff changeset
5189 "conversation-displayed", PIDGIN_CONVERSATION(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5190 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5191
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5192 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5193 received_im_msg_cb(PurpleAccount *account, char *sender, char *message,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5194 PurpleConversation *conv, PurpleMessageFlags flags)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5195 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5196 PurpleConversationUiOps *ui_ops = pidgin_conversations_get_conv_ui_ops();
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5197 gboolean hide = FALSE;
19897
922960f829f9 disapproval of revision '08f542359200866bb7a302653d875cdeccb8df01'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
5198
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5199 /* create hidden conv if hide_new pref is always */
19897
922960f829f9 disapproval of revision '08f542359200866bb7a302653d875cdeccb8df01'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
5200 if (strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/im/hide_new"), "always") == 0)
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5201 hide = TRUE;
19897
922960f829f9 disapproval of revision '08f542359200866bb7a302653d875cdeccb8df01'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
5202
922960f829f9 disapproval of revision '08f542359200866bb7a302653d875cdeccb8df01'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
5203 /* create hidden conv if hide_new pref is away and account is away */
922960f829f9 disapproval of revision '08f542359200866bb7a302653d875cdeccb8df01'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
5204 if (strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/im/hide_new"), "away") == 0 &&
922960f829f9 disapproval of revision '08f542359200866bb7a302653d875cdeccb8df01'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
5205 !purple_status_is_available(purple_account_get_active_status(account)))
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5206 hide = TRUE;
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5207
21772
21371ea85970 Fix boldifying the chat entries in the buddylist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21766
diff changeset
5208 if (conv && PIDGIN_IS_PIDGIN_CONVERSATION(conv) && !hide) {
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5209 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5210 if (gtkconv->win == hidden_convwin) {
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5211 pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv);
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5212 pidgin_conv_placement_place(gtkconv);
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5213 }
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5214 return;
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5215 }
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5216
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5217 if (hide) {
19897
922960f829f9 disapproval of revision '08f542359200866bb7a302653d875cdeccb8df01'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
5218 ui_ops->create_conversation = pidgin_conv_new_hidden;
922960f829f9 disapproval of revision '08f542359200866bb7a302653d875cdeccb8df01'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
5219 purple_conversation_new(PURPLE_CONV_TYPE_IM, account, sender);
922960f829f9 disapproval of revision '08f542359200866bb7a302653d875cdeccb8df01'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
5220 ui_ops->create_conversation = pidgin_conv_new;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5221 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5222 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5223
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5224 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5225 pidgin_conv_destroy(PurpleConversation *conv)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5226 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5227 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5228
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5229 gtkconv->convs = g_list_remove(gtkconv->convs, conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5230 /* Don't destroy ourselves until all our convos are gone */
18452
45865fb3f4f9 Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18341
diff changeset
5231 if (gtkconv->convs) {
45865fb3f4f9 Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18341
diff changeset
5232 /* Make sure the destroyed conversation is not the active one */
45865fb3f4f9 Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18341
diff changeset
5233 if (gtkconv->active_conv == conv) {
45865fb3f4f9 Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18341
diff changeset
5234 gtkconv->active_conv = gtkconv->convs->data;
45865fb3f4f9 Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18341
diff changeset
5235 purple_conversation_update(gtkconv->active_conv, PURPLE_CONV_UPDATE_FEATURES);
45865fb3f4f9 Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18341
diff changeset
5236 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5237 return;
18452
45865fb3f4f9 Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18341
diff changeset
5238 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5239
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5240 pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5241
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5242 /* If the "Save Conversation" or "Save Icon" dialogs are open then close them */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5243 purple_request_close_with_handle(gtkconv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5244 purple_notify_close_with_handle(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5245
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5246 gtk_widget_destroy(gtkconv->tab_cont);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5247 g_object_unref(gtkconv->tab_cont);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5248
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5249 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5250 if (gtkconv->u.im->icon_timer != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5251 g_source_remove(gtkconv->u.im->icon_timer);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5252
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5253 if (gtkconv->u.im->anim != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5254 g_object_unref(G_OBJECT(gtkconv->u.im->anim));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5255
16273
143b508024c0 Patch from khc to remove the typing notifcation callback when the window is
Stu Tomlinson <stu@nosnilmot.com>
parents: 16229
diff changeset
5256 if (gtkconv->u.im->typing_timer != 0)
143b508024c0 Patch from khc to remove the typing notifcation callback when the window is
Stu Tomlinson <stu@nosnilmot.com>
parents: 16229
diff changeset
5257 g_source_remove(gtkconv->u.im->typing_timer);
143b508024c0 Patch from khc to remove the typing notifcation callback when the window is
Stu Tomlinson <stu@nosnilmot.com>
parents: 16229
diff changeset
5258
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5259 g_free(gtkconv->u.im);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5260 } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5261 purple_signals_disconnect_by_handle(gtkconv->u.chat);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5262 g_free(gtkconv->u.chat);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5263 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5264
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5265 gtk_object_sink(GTK_OBJECT(gtkconv->tooltips));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5266
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5267 gtkconv->send_history = g_list_first(gtkconv->send_history);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5268 g_list_foreach(gtkconv->send_history, (GFunc)g_free, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5269 g_list_free(gtkconv->send_history);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5270
19421
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
5271 if (gtkconv->attach.timer) {
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
5272 g_source_remove(gtkconv->attach.timer);
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
5273 }
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
5274
19227
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
5275 if (tooltip.gtkconv == gtkconv)
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
5276 reset_tooltip();
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
5277
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5278 g_free(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5279 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5280
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5281
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5282 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5283 pidgin_conv_write_im(PurpleConversation *conv, const char *who,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5284 const char *message, PurpleMessageFlags flags,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5285 time_t mtime)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5286 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5287 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5288
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5289 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5290
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5291 if (conv != gtkconv->active_conv &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5292 flags & PURPLE_MESSAGE_ACTIVE_ONLY)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5293 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5294 /* Plugins that want these messages suppressed should be
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5295 * calling purple_conv_im_write(), so they get suppressed here,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5296 * before being written to the log. */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5297 purple_debug_info("gtkconv",
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
5298 "Suppressing message for an inactive conversation in pidgin_conv_write_im()\n");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5299 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5300 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5301
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5302 purple_conversation_write(conv, who, message, flags, mtime);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5303 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5304
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5305 /* The callback for an event on a link tag. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5306 static gboolean buddytag_event(GtkTextTag *tag, GObject *imhtml,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5307 GdkEvent *event, GtkTextIter *arg2, gpointer data) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5308 if (event->type == GDK_BUTTON_PRESS
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5309 || event->type == GDK_2BUTTON_PRESS) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5310 GdkEventButton *btn_event = (GdkEventButton*) event;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5311 PurpleConversation *conv = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5312 char *buddyname;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5313
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5314 /* strlen("BUDDY ") == 6 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5315 g_return_val_if_fail((tag->name != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5316 && (strlen(tag->name) > 6), FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5317
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5318 buddyname = (tag->name) + 6;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5319
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5320 if (btn_event->button == 2
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5321 && event->type == GDK_2BUTTON_PRESS) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5322 chat_do_info(PIDGIN_CONVERSATION(conv), buddyname);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5323
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5324 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5325 } else if (btn_event->button == 3
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5326 && event->type == GDK_BUTTON_PRESS) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5327 GtkTextIter start, end;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5328
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5329 /* we shouldn't display the popup
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5330 * if the user has selected something: */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5331 if (!gtk_text_buffer_get_selection_bounds(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5332 gtk_text_iter_get_buffer(arg2),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5333 &start, &end)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5334 GtkWidget *menu = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5335 PurpleConnection *gc =
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5336 purple_conversation_get_gc(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5337
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5338
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5339 menu = create_chat_menu(conv, buddyname, gc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5340 gtk_menu_popup(GTK_MENU(menu), NULL, NULL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5341 NULL, GTK_WIDGET(imhtml),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5342 btn_event->button,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5343 btn_event->time);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5344
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5345 /* Don't propagate the event any further */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5346 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5347 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5348 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5349 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5350
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5351 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5352 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5353
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5354 static GtkTextTag *get_buddy_tag(PurpleConversation *conv, const char *who) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5355 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5356 GtkTextTag *buddytag;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5357 gchar *str;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5358
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5359 str = g_strdup_printf("BUDDY %s", who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5360
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5361 buddytag = gtk_text_tag_table_lookup(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5362 gtk_text_buffer_get_tag_table(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5363 GTK_IMHTML(gtkconv->imhtml)->text_buffer), str);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5364
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5365 if (buddytag == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5366 buddytag = gtk_text_buffer_create_tag(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5367 GTK_IMHTML(gtkconv->imhtml)->text_buffer, str, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5368
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5369 g_signal_connect(G_OBJECT(buddytag), "event",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5370 G_CALLBACK(buddytag_event), conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5371 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5372
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5373 g_free(str);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5375 return buddytag;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5376 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5377
15519
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5378 static void pidgin_conv_calculate_newday(PidginConversation *gtkconv, time_t mtime)
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5379 {
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5380 struct tm *tm = localtime(&mtime);
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5381
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5382 tm->tm_hour = tm->tm_min = tm->tm_sec = 0;
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5383 tm->tm_mday++;
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5384
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5385 gtkconv->newday = mktime(tm);
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5386 }
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5387
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5388 /* Detect string direction and encapsulate the string in RLE/LRE/PDF unicode characters
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5389 str - pointer to string (string is re-allocated and the pointer updated) */
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5390 static void
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5391 str_embed_direction_chars(char **str)
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5392 {
16229
12e2ee612d5f Fix for using Pango < 1.4, will not have complete RTL support with older
Stu Tomlinson <stu@nosnilmot.com>
parents: 16202
diff changeset
5393 #ifdef HAVE_PANGO14
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5394 char pre_str[4];
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5395 char post_str[10];
16229
12e2ee612d5f Fix for using Pango < 1.4, will not have complete RTL support with older
Stu Tomlinson <stu@nosnilmot.com>
parents: 16202
diff changeset
5396 char *ret;
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5397
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5398 if (PANGO_DIRECTION_RTL == pango_find_base_dir(*str, -1))
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5399 {
16229
12e2ee612d5f Fix for using Pango < 1.4, will not have complete RTL support with older
Stu Tomlinson <stu@nosnilmot.com>
parents: 16202
diff changeset
5400 sprintf(pre_str, "%c%c%c",
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5401 0xE2, 0x80, 0xAB); /* RLE */
16229
12e2ee612d5f Fix for using Pango < 1.4, will not have complete RTL support with older
Stu Tomlinson <stu@nosnilmot.com>
parents: 16202
diff changeset
5402 sprintf(post_str, "%c%c%c%c%c%c%c%c%c",
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5403 0xE2, 0x80, 0xAC, /* PDF */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5404 0xE2, 0x80, 0x8E, /* LRM */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5405 0xE2, 0x80, 0xAC); /* PDF */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5406 }
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5407 else
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5408 {
16229
12e2ee612d5f Fix for using Pango < 1.4, will not have complete RTL support with older
Stu Tomlinson <stu@nosnilmot.com>
parents: 16202
diff changeset
5409 sprintf(pre_str, "%c%c%c",
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5410 0xE2, 0x80, 0xAA); /* LRE */
16229
12e2ee612d5f Fix for using Pango < 1.4, will not have complete RTL support with older
Stu Tomlinson <stu@nosnilmot.com>
parents: 16202
diff changeset
5411 sprintf(post_str, "%c%c%c%c%c%c%c%c%c",
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5412 0xE2, 0x80, 0xAC, /* PDF */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5413 0xE2, 0x80, 0x8F, /* RLM */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5414 0xE2, 0x80, 0xAC); /* PDF */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5415 }
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5416
16229
12e2ee612d5f Fix for using Pango < 1.4, will not have complete RTL support with older
Stu Tomlinson <stu@nosnilmot.com>
parents: 16202
diff changeset
5417 ret = g_strconcat(pre_str, *str, post_str, NULL);
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5418
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5419 g_free(*str);
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5420 *str = ret;
16229
12e2ee612d5f Fix for using Pango < 1.4, will not have complete RTL support with older
Stu Tomlinson <stu@nosnilmot.com>
parents: 16202
diff changeset
5421 #endif
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5422 }
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5423
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5424 /* Returns true if the given HTML contains RTL text */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5425 static gboolean
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5426 html_is_rtl(const char *html)
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5427 {
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5428 GData *attributes;
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5429 const gchar *start, *end;
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5430 gboolean res = FALSE;
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5431
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5432 if (purple_markup_find_tag("span", html, &start, &end, &attributes))
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5433 {
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5434 /* tmp is a member of attributes and is free with g_datalist_clear call */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5435 const char *tmp = g_datalist_get_data(&attributes, "dir");
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5436 if (tmp && !g_ascii_strcasecmp(tmp, "RTL"))
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5437 res = TRUE;
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5438 if (!res)
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5439 {
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5440 tmp = g_datalist_get_data(&attributes, "style");
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5441 if (tmp)
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5442 {
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5443 char *tmp2 = purple_markup_get_css_property(tmp, "direction");
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5444 if (tmp2 && !g_ascii_strcasecmp(tmp2, "RTL"))
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5445 res = TRUE;
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5446 g_free(tmp2);
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5447 }
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5448
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5449 }
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5450 g_datalist_clear(&attributes);
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5451 }
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5452 return res;
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5453 }
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5454
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5455
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5456 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5457 pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *alias,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5458 const char *message, PurpleMessageFlags flags,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5459 time_t mtime)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5460 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5461 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5462 PidginWindow *win;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5463 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5464 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5465 PurplePluginProtocolInfo *prpl_info;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5466 int gtk_font_options = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5467 int gtk_font_options_all = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5468 int max_scrollback_lines;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5469 int line_count;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5470 char buf2[BUF_LONG];
15519
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5471 gboolean show_date;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5472 char *mdate;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5473 char color[10];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5474 char *str;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5475 char *with_font_tag;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5476 char *sml_attrib = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5477 size_t length;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5478 PurpleConversationType type;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5479 char *displaying;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5480 gboolean plugin_return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5481 char *bracket;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5482 int tag_count = 0;
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5483 gboolean is_rtl_message = FALSE;
16964
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5484 GtkSmileyTree *tree = NULL;
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5485 GHashTable *smiley_data = NULL;
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
5486
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5487 g_return_if_fail(conv != NULL);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5488 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5489 g_return_if_fail(gtkconv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5490
19421
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
5491 if (gtkconv->attach.timer) {
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
5492 /* We are currently in the process of filling up the buffer with the message
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
5493 * history of the conversation. So we do not need to add the message here.
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
5494 * Instead, this message will be added to the message-list, which in turn will
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
5495 * be processed and displayed by the attach-callback.
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
5496 */
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
5497 return;
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
5498 }
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
5499
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5500 if (conv != gtkconv->active_conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5501 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5502 if (flags & PURPLE_MESSAGE_ACTIVE_ONLY)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5503 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5504 /* Unless this had PURPLE_MESSAGE_NO_LOG, this message
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5505 * was logged. Plugin writers: if this isn't what
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5506 * you wanted, call purple_conv_im_write() instead of
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5507 * purple_conversation_write(). */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5508 purple_debug_info("gtkconv",
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
5509 "Suppressing message for an inactive conversation in pidgin_conv_write_conv()\n");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5510 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5511 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5512
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5513 /* Set the active conversation to the one that just messaged us. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5514 /* TODO: consider not doing this if the account is offline or something */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5515 if (flags & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV))
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
5516 pidgin_conv_switch_active_conversation(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5517 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5518
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5519 type = purple_conversation_get_type(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5520 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5521 g_return_if_fail(account != NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5522 gc = purple_account_get_connection(account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5523 g_return_if_fail(gc != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5524
15579
74b945e7609c Moved linkification of incoming messages to pidgin_conv_write_conv()
Evan Schoenberg <evan.s@dreskin.net>
parents: 15560
diff changeset
5525 /* Make sure URLs are clickable */
18025
7790021b1270 add a PURPLE_MESSAGE_NO_LINKIFY to prevent things from getting linkified
Nathan Walp <nwalp@pidgin.im>
parents: 18024
diff changeset
5526 if(flags & PURPLE_MESSAGE_NO_LINKIFY)
7790021b1270 add a PURPLE_MESSAGE_NO_LINKIFY to prevent things from getting linkified
Nathan Walp <nwalp@pidgin.im>
parents: 18024
diff changeset
5527 displaying = g_strdup(message);
7790021b1270 add a PURPLE_MESSAGE_NO_LINKIFY to prevent things from getting linkified
Nathan Walp <nwalp@pidgin.im>
parents: 18024
diff changeset
5528 else
7790021b1270 add a PURPLE_MESSAGE_NO_LINKIFY to prevent things from getting linkified
Nathan Walp <nwalp@pidgin.im>
parents: 18024
diff changeset
5529 displaying = purple_markup_linkify(message);
7790021b1270 add a PURPLE_MESSAGE_NO_LINKIFY to prevent things from getting linkified
Nathan Walp <nwalp@pidgin.im>
parents: 18024
diff changeset
5530
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5531 plugin_return = GPOINTER_TO_INT(purple_signal_emit_return_1(
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5532 pidgin_conversations_get_handle(), (type == PURPLE_CONV_TYPE_IM ?
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5533 "displaying-im-msg" : "displaying-chat-msg"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5534 account, name, &displaying, conv, flags));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5535 if (plugin_return)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5536 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5537 g_free(displaying);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5538 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5539 }
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5540 length = strlen(displaying) + 1;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5541
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5542 /* Awful hack to work around GtkIMHtml's inefficient rendering of messages with lots of formatting changes.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5543 * If a message has over 100 '<' characters, strip formatting before appending it. Hopefully nobody actually
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5544 * needs that much formatting, anyway.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5545 */
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5546 for (bracket = strchr(displaying, '<'); bracket && *(bracket + 1); bracket = strchr(bracket + 1, '<'))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5547 tag_count++;
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5548
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5549 if (tag_count > 100) {
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5550 char *tmp = displaying;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5551 displaying = purple_markup_strip_html(tmp);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5552 g_free(tmp);
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5553 }
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5554
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5555 win = gtkconv->win;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5556 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5557
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5558 line_count = gtk_text_buffer_get_line_count(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5559 gtk_text_view_get_buffer(GTK_TEXT_VIEW(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5560 gtkconv->imhtml)));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5561
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5562 max_scrollback_lines = purple_prefs_get_int(
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
5563 PIDGIN_PREFS_ROOT "/conversations/scrollback_lines");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5564 /* If we're sitting at more than 100 lines more than the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5565 max scrollback, trim down to max scrollback */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5566 if (max_scrollback_lines > 0
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5567 && line_count > (max_scrollback_lines + 100)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5568 GtkTextBuffer *text_buffer = gtk_text_view_get_buffer(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5569 GTK_TEXT_VIEW(gtkconv->imhtml));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5570 GtkTextIter start, end;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5571
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5572 gtk_text_buffer_get_start_iter(text_buffer, &start);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5573 gtk_text_buffer_get_iter_at_line(text_buffer, &end,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5574 (line_count - max_scrollback_lines));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5575 gtk_imhtml_delete(GTK_IMHTML(gtkconv->imhtml), &start, &end);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5576 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5577
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5578 if (type == PURPLE_CONV_TYPE_CHAT)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5579 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5580 /* Create anchor for user */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5581 GtkTextIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5582 char *tmp = g_strconcat("user:", name, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5583
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5584 gtk_text_buffer_get_end_iter(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)), &iter);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5585 gtk_text_buffer_create_mark(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5586 tmp, &iter, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5587 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5588 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5589
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
5590 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/use_smooth_scrolling"))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5591 gtk_font_options_all |= GTK_IMHTML_USE_SMOOTHSCROLLING;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5592
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5593 if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml))))
18760
bf47d0401a96 Eliminate some unnecessary scrolling activity.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18671
diff changeset
5594 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", gtk_font_options_all | GTK_IMHTML_NO_SCROLL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5595
15519
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5596 /* First message in a conversation. */
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5597 if (gtkconv->newday == 0)
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5598 pidgin_conv_calculate_newday(gtkconv, mtime);
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5599
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5600 /* Show the date on the first message in a new day, or if the message is
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5601 * older than 20 minutes. */
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5602 show_date = (mtime >= gtkconv->newday) || (time(NULL) > mtime + 20*60);
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5603
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5604 mdate = purple_signal_emit_return_1(pidgin_conversations_get_handle(),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5605 "conversation-timestamp",
15519
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5606 conv, mtime, show_date);
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5607
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5608 if (mdate == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5609 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5610 struct tm *tm = localtime(&mtime);
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5611 const char *tmp;
15519
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5612 if (show_date)
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5613 tmp = purple_date_format_long(tm);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5614 else
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5615 tmp = purple_time_format(tm);
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5616 mdate = g_strdup_printf("(%s)", tmp);
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5617 }
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5618
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5619 /* Bi-Directional support - set timestamp direction using unicode characters */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5620 is_rtl_message = html_is_rtl(message);
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5621 /* Enforce direction only if message is RTL - doesn't effect LTR users */
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5622 if (is_rtl_message)
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5623 str_embed_direction_chars(&mdate);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5624
15519
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5625 if (mtime >= gtkconv->newday)
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5626 pidgin_conv_calculate_newday(gtkconv, mtime);
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5627
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5628 sml_attrib = g_strdup_printf("sml=\"%s\"", purple_account_get_protocol_name(account));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5629
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5630 gtk_font_options |= GTK_IMHTML_NO_COMMENTS;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5631
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5632 if ((flags & PURPLE_MESSAGE_RECV) &&
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
5633 !purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_incoming_formatting"))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5634 gtk_font_options |= GTK_IMHTML_NO_COLOURS | GTK_IMHTML_NO_FONTS | GTK_IMHTML_NO_SIZES | GTK_IMHTML_NO_FORMATTING;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5635
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5636 /* this is gonna crash one day, I can feel it. */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5637 if (PURPLE_PLUGIN_PROTOCOL_INFO(purple_find_prpl(purple_account_get_protocol_id(conv->account)))->options &
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5638 OPT_PROTO_USE_POINTSIZE) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5639 gtk_font_options |= GTK_IMHTML_USE_POINTSIZE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5640 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5641
16964
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5642 if (!(flags & PURPLE_MESSAGE_RECV))
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5643 {
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5644 /* Temporarily revert to the original smiley-data to avoid showing up
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5645 * custom smileys of the buddy when sending message
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5646 */
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5647 tree = GTK_IMHTML(gtkconv->imhtml)->default_smilies;
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5648 GTK_IMHTML(gtkconv->imhtml)->default_smilies =
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5649 GTK_IMHTML(gtkconv->entry)->default_smilies;
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5650 smiley_data = GTK_IMHTML(gtkconv->imhtml)->smiley_data;
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5651 GTK_IMHTML(gtkconv->imhtml)->smiley_data = GTK_IMHTML(gtkconv->entry)->smiley_data;
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5652 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5653
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5654 /* TODO: These colors should not be hardcoded so log.c can use them */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5655 if (flags & PURPLE_MESSAGE_RAW) {
15602
b03021cef5cb SF Patch #1653845 from Matt Perry
Richard Laager <rlaager@wiktel.com>
parents: 15579
diff changeset
5656 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), message, gtk_font_options_all);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5657 } else if (flags & PURPLE_MESSAGE_SYSTEM) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5658 g_snprintf(buf2, sizeof(buf2),
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5659 "<FONT %s><FONT SIZE=\"2\"><!--%s --></FONT><B>%s</B></FONT>",
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5660 sml_attrib ? sml_attrib : "", mdate, displaying);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5661
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5662 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5663
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5664 } else if (flags & PURPLE_MESSAGE_ERROR) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5665 g_snprintf(buf2, sizeof(buf2),
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5666 "<FONT COLOR=\"#ff0000\"><FONT %s><FONT SIZE=\"2\"><!--%s --></FONT><B>%s</B></FONT></FONT>",
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5667 sml_attrib ? sml_attrib : "", mdate, displaying);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5668
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5669 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5670
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5671 } else if (flags & PURPLE_MESSAGE_NO_LOG) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5672 g_snprintf(buf2, BUF_LONG,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5673 "<B><FONT %s COLOR=\"#777777\">%s</FONT></B>",
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5674 sml_attrib ? sml_attrib : "", displaying);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5675
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5676 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5677 } else {
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5678 char *new_message = g_memdup(displaying, length);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5679 char *alias_escaped = (alias ? g_markup_escape_text(alias, strlen(alias)) : g_strdup(""));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5680 /* The initial offset is to deal with
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5681 * escaped entities making the string longer */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5682 int tag_start_offset = alias ? (strlen(alias_escaped) - strlen(alias)) : 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5683 int tag_end_offset = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5684
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5685 /* Enforce direction on alias */
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5686 if (is_rtl_message)
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5687 str_embed_direction_chars(&alias_escaped);
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5688
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5689 if (flags & PURPLE_MESSAGE_WHISPER) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5690 str = g_malloc(1024);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5691
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5692 /* If we're whispering, it's not an autoresponse. */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5693 if (purple_message_meify(new_message, -1 )) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5694 g_snprintf(str, 1024, "***%s", alias_escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5695 strcpy(color, "#6C2585");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5696 tag_start_offset += 3;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5697 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5698 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5699 g_snprintf(str, 1024, "*%s*:", alias_escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5700 tag_start_offset += 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5701 tag_end_offset = 2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5702 strcpy(color, "#00FF00");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5703 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5704 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5705 else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5706 if (purple_message_meify(new_message, -1)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5707 str = g_malloc(1024);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5708
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5709 if (flags & PURPLE_MESSAGE_AUTO_RESP) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5710 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, alias_escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5711 tag_start_offset += 4
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5712 + strlen(AUTO_RESPONSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5713 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5714 g_snprintf(str, 1024, "***%s", alias_escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5715 tag_start_offset += 3;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5716 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5717
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5718 if (flags & PURPLE_MESSAGE_NICK)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5719 strcpy(color, HIGHLIGHT_COLOR);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5720 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5721 strcpy(color, "#062585");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5722 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5723 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5724 str = g_malloc(1024);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5725 if (flags & PURPLE_MESSAGE_AUTO_RESP) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5726 g_snprintf(str, 1024, "%s %s", alias_escaped, AUTO_RESPONSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5727 tag_start_offset += 1
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5728 + strlen(AUTO_RESPONSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5729 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5730 g_snprintf(str, 1024, "%s:", alias_escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5731 tag_end_offset = 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5732 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5733 if (flags & PURPLE_MESSAGE_NICK)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5734 strcpy(color, HIGHLIGHT_COLOR);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5735 else if (flags & PURPLE_MESSAGE_RECV) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5736 if (type == PURPLE_CONV_TYPE_CHAT) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5737 GdkColor *col = get_nick_color(gtkconv, name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5738
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5739 g_snprintf(color, sizeof(color), "#%02X%02X%02X",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5740 col->red >> 8, col->green >> 8, col->blue >> 8);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5741 } else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5742 strcpy(color, RECV_COLOR);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5743 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5744 else if (flags & PURPLE_MESSAGE_SEND)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5745 strcpy(color, SEND_COLOR);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5746 else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5747 purple_debug_error("gtkconv", "message missing flags\n");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5748 strcpy(color, "#000000");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5749 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5750 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5751 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5752
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5753 g_free(alias_escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5754
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5755 /* Are we in a chat where we can tell which users are buddies? */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5756 if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME) &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5757 purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5758
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5759 /* Bold buddies to make them stand out from non-buddies. */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5760 if (flags & PURPLE_MESSAGE_SEND ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5761 flags & PURPLE_MESSAGE_NICK ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5762 purple_find_buddy(account, name) != NULL) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5763 g_snprintf(buf2, BUF_LONG,
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5764 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\"><!--%s --></FONT>"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5765 "<B>%s</B></FONT> ",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5766 color, sml_attrib ? sml_attrib : "", mdate, str);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5767 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5768 g_snprintf(buf2, BUF_LONG,
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5769 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\"><!--%s --></FONT>"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5770 "%s</FONT> ",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5771 color, sml_attrib ? sml_attrib : "", mdate, str);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5772
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5773 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5774 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5775 /* Bold everyone's name to make the name stand out from the message. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5776 g_snprintf(buf2, BUF_LONG,
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5777 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\"><!--%s --></FONT>"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5778 "<B>%s</B></FONT> ",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5779 color, sml_attrib ? sml_attrib : "", mdate, str);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5780 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5781
18760
bf47d0401a96 Eliminate some unnecessary scrolling activity.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18671
diff changeset
5782 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all | GTK_IMHTML_NO_SCROLL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5783
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5784 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT &&
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5785 !(flags & PURPLE_MESSAGE_SEND)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5786
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5787 GtkTextIter start, end;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5788 GtkTextTag *buddytag = get_buddy_tag(conv, name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5789
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5790 gtk_text_buffer_get_end_iter(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5791 GTK_IMHTML(gtkconv->imhtml)->text_buffer,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5792 &end);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5793 gtk_text_iter_backward_chars(&end,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5794 tag_end_offset + 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5795
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5796 gtk_text_buffer_get_end_iter(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5797 GTK_IMHTML(gtkconv->imhtml)->text_buffer,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5798 &start);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5799 gtk_text_iter_backward_chars(&start,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5800 strlen(str) + 1 - tag_start_offset);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5801
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5802 gtk_text_buffer_apply_tag(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5803 GTK_IMHTML(gtkconv->imhtml)->text_buffer,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5804 buddytag, &start, &end);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5805 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5806
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5807 g_free(str);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5808
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5809 if(gc){
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5810 char *pre = g_strdup_printf("<font %s>", sml_attrib ? sml_attrib : "");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5811 char *post = "</font>";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5812 int pre_len = strlen(pre);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5813 int post_len = strlen(post);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5814
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5815 with_font_tag = g_malloc(length + pre_len + post_len + 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5816
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5817 strcpy(with_font_tag, pre);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5818 memcpy(with_font_tag + pre_len, new_message, length);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5819 strcpy(with_font_tag + pre_len + length, post);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5820
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5821 length += pre_len + post_len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5822 g_free(pre);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5823 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5824 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5825 with_font_tag = g_memdup(new_message, length);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5826
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5827 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5828 with_font_tag, gtk_font_options | gtk_font_options_all);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5829
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5830 g_free(with_font_tag);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5831 g_free(new_message);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5832 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5833
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5834 g_free(mdate);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5835 g_free(sml_attrib);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5836
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5837 /* Tab highlighting stuff */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5838 if (!(flags & PURPLE_MESSAGE_SEND) && !pidgin_conv_has_focus(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5839 {
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
5840 PidginUnseenState unseen = PIDGIN_UNSEEN_NONE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5841
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5842 if ((flags & PURPLE_MESSAGE_NICK) == PURPLE_MESSAGE_NICK)
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
5843 unseen = PIDGIN_UNSEEN_NICK;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5844 else if (((flags & PURPLE_MESSAGE_SYSTEM) == PURPLE_MESSAGE_SYSTEM) ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5845 ((flags & PURPLE_MESSAGE_ERROR) == PURPLE_MESSAGE_ERROR))
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
5846 unseen = PIDGIN_UNSEEN_EVENT;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5847 else if ((flags & PURPLE_MESSAGE_NO_LOG) == PURPLE_MESSAGE_NO_LOG)
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
5848 unseen = PIDGIN_UNSEEN_NO_LOG;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5849 else
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
5850 unseen = PIDGIN_UNSEEN_TEXT;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5851
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5852 gtkconv_set_unseen(gtkconv, unseen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5853 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5854
16964
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5855 if (!(flags & PURPLE_MESSAGE_RECV))
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5856 {
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5857 /* Restore the smiley-data */
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5858 GTK_IMHTML(gtkconv->imhtml)->default_smilies = tree;
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5859 GTK_IMHTML(gtkconv->imhtml)->smiley_data = smiley_data;
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5860 }
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5861
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5862 purple_signal_emit(pidgin_conversations_get_handle(),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5863 (type == PURPLE_CONV_TYPE_IM ? "displayed-im-msg" : "displayed-chat-msg"),
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5864 account, name, displaying, conv, flags);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5865 g_free(displaying);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5866 }
19559
11849a5c3951 Update the chat topic and userlist when reattaching the Pidgin UI.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19556
diff changeset
5867
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5868 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5869 pidgin_conv_chat_add_users(PurpleConversation *conv, GList *cbuddies, gboolean new_arrivals)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5870 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5871 PurpleConvChat *chat;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5872 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5873 PidginChatPane *gtkchat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5874 GtkListStore *ls;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5875 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5876
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5877 char tmp[BUF_LONG];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5878 int num_users;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5879
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5880 chat = PURPLE_CONV_CHAT(conv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5881 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5882 gtkchat = gtkconv->u.chat;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5883
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
5884 num_users = g_list_length(purple_conv_chat_get_users(chat));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5885
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5886 g_snprintf(tmp, sizeof(tmp),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5887 ngettext("%d person in room", "%d people in room",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5888 num_users),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5889 num_users);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5890
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5891 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5892
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5893 ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5894
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5895 #if GTK_CHECK_VERSION(2,6,0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5896 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5897 GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5898 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5899
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5900 l = cbuddies;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5901 while (l != NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5902 add_chat_buddy_common(conv, (PurpleConvChatBuddy *)l->data, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5903 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5904 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5905
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5906 /* Currently GTK+ maintains our sorted list after it's in the tree.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5907 * This may change if it turns out we can manage it faster ourselves.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5908 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5909 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), CHAT_USERS_ALIAS_KEY_COLUMN,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5910 GTK_SORT_ASCENDING);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5911 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5912
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5913 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5914 pidgin_conv_chat_rename_user(PurpleConversation *conv, const char *old_name,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5915 const char *new_name, const char *new_alias)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5916 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5917 PurpleConvChat *chat;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5918 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5919 PidginChatPane *gtkchat;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5920 PurpleConvChatBuddyFlags flags;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5921 PurpleConvChatBuddy *cbuddy;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5922 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5923 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5924 int f = 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5925
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5926 chat = PURPLE_CONV_CHAT(conv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5927 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5928 gtkchat = gtkconv->u.chat;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5929
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5930 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5931
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5932 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5933 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5934
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5935 while (f != 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5936 char *val;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5937
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5938 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &val, CHAT_USERS_FLAGS_COLUMN, &flags, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5939
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5940 if (!purple_utf8_strcasecmp(old_name, val)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5941 gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5942 g_free(val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5943 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5944 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5945
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5946 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5947
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5948 g_free(val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5949 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5950
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5951 if (!purple_conv_chat_find_user(chat, old_name))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5952 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5953
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5954 g_return_if_fail(new_alias != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5955
18305
ffd706ec0220 Set and use convchatbuddy->buddy.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18302
diff changeset
5956 cbuddy = purple_conv_chat_cb_find(chat, new_name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5957
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5958 add_chat_buddy_common(conv, cbuddy, old_name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5959 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5960
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5961 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5962 pidgin_conv_chat_remove_users(PurpleConversation *conv, GList *users)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5963 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5964 PurpleConvChat *chat;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5965 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5966 PidginChatPane *gtkchat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5967 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5968 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5969 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5970 char tmp[BUF_LONG];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5971 int num_users;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5972 gboolean f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5973
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5974 chat = PURPLE_CONV_CHAT(conv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5975 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5976 gtkchat = gtkconv->u.chat;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5977
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
5978 num_users = g_list_length(purple_conv_chat_get_users(chat));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5979
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5980 for (l = users; l != NULL; l = l->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5981 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5982
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5983 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5984 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5985
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5986 do {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5987 char *val;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5988
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5989 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5990 CHAT_USERS_NAME_COLUMN, &val, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5991
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5992 if (!purple_utf8_strcasecmp((char *)l->data, val)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5993 #if GTK_CHECK_VERSION(2,2,0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5994 f = gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5995 #else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5996 gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5997 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5998 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5999 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6000 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6001 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6002
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6003 g_free(val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6004 } while (f);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6005 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6006
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6007 g_snprintf(tmp, sizeof(tmp),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6008 ngettext("%d person in room", "%d people in room",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6009 num_users), num_users);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6010
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6011 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6012 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6013
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6014 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6015 pidgin_conv_chat_update_user(PurpleConversation *conv, const char *user)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6016 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6017 PurpleConvChat *chat;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6018 PurpleConvChatBuddyFlags flags;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6019 PurpleConvChatBuddy *cbuddy;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6020 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6021 PidginChatPane *gtkchat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6022 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6023 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6024 int f = 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6025 char *alias = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6026
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6027 chat = PURPLE_CONV_CHAT(conv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6028 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6029 gtkchat = gtkconv->u.chat;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6030
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6031 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6032
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6033 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6034 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6035
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6036 while (f != 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6037 char *val;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6038
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6039 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &val, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6040
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6041 if (!purple_utf8_strcasecmp(user, val)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6042 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_ALIAS_COLUMN, &alias, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6043 gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6044 g_free(val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6045 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6046 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6047
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6048 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6049
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6050 g_free(val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6051 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6052
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6053 if (!purple_conv_chat_find_user(chat, user))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6054 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6055 g_free(alias);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6056 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6057 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6058
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6059 g_return_if_fail(alias != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6060
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6061 flags = purple_conv_chat_user_get_flags(chat, user);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6062
17082
4876375de307 Plug a leak when the flags for a user in a chat changes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17056
diff changeset
6063 cbuddy = purple_conv_chat_cb_find(chat, user);
4876375de307 Plug a leak when the flags for a user in a chat changes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17056
diff changeset
6064 if (cbuddy)
4876375de307 Plug a leak when the flags for a user in a chat changes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17056
diff changeset
6065 add_chat_buddy_common(conv, cbuddy, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6066 g_free(alias);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6067 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6068
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6069 gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6070 pidgin_conv_has_focus(PurpleConversation *conv)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6071 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6072 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6073 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6074 gboolean has_focus;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6075
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6076 win = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6077
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6078 g_object_get(G_OBJECT(win->window), "has-toplevel-focus", &has_focus, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6079
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6080 if (has_focus && pidgin_conv_window_is_active_conversation(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6081 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6082
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6083 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6084 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6085
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6086 static void pidgin_conv_custom_smiley_allocated(GdkPixbufLoader *loader, gpointer user_data)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6087 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6088 GtkIMHtmlSmiley *smiley;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6089
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6090 smiley = (GtkIMHtmlSmiley *)user_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6091 smiley->icon = gdk_pixbuf_loader_get_animation(loader);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6092
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6093 if (smiley->icon)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6094 g_object_ref(G_OBJECT(smiley->icon));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6095 #ifdef DEBUG_CUSTOM_SMILEY
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6096 purple_debug_info("custom-smiley", "pidgin_conv_custom_smiley_allocated(): got GdkPixbufAnimation %p for smiley '%s'\n", smiley->icon, smiley->smile);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6097 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6098 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6099
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6100 static void pidgin_conv_custom_smiley_closed(GdkPixbufLoader *loader, gpointer user_data)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6101 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6102 GtkIMHtmlSmiley *smiley;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6103 GtkWidget *icon = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6104 GtkTextChildAnchor *anchor = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6105 GSList *current = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6106
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6107 smiley = (GtkIMHtmlSmiley *)user_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6108 if (!smiley->imhtml) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6109 #ifdef DEBUG_CUSTOM_SMILEY
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6110 purple_debug_error("custom-smiley", "pidgin_conv_custom_smiley_closed(): orphan smiley found: %p\n", smiley);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6111 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6112 g_object_unref(G_OBJECT(loader));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6113 smiley->loader = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6114 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6115 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6116
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6117 for (current = smiley->anchors; current; current = g_slist_next(current)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6118
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6119 icon = gtk_image_new_from_animation(smiley->icon);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6120
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6121 #ifdef DEBUG_CUSTOM_SMILEY
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6122 purple_debug_info("custom-smiley", "pidgin_conv_custom_smiley_closed(): got GtkImage %p from GtkPixbufAnimation %p for smiley '%s'\n",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6123 icon, smiley->icon, smiley->smile);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6124 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6125 if (icon) {
16964
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
6126 GList *wids;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6127 gtk_widget_show(icon);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6128
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6129 anchor = GTK_TEXT_CHILD_ANCHOR(current->data);
16964
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
6130 wids = gtk_text_child_anchor_get_widgets(anchor);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6131
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6132 g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_plaintext", purple_unescape_html(smiley->smile), g_free);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6133 g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_htmltext", g_strdup(smiley->smile), g_free);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6134
16964
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
6135 if (smiley->imhtml) {
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
6136 if (wids) {
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
6137 GList *children = gtk_container_get_children(GTK_CONTAINER(wids->data));
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
6138 g_list_foreach(children, (GFunc)gtk_widget_destroy, NULL);
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
6139 g_list_free(children);
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
6140 gtk_container_add(GTK_CONTAINER(wids->data), icon);
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
6141 } else
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
6142 gtk_text_view_add_child_at_anchor(GTK_TEXT_VIEW(smiley->imhtml), icon, anchor);
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
6143 }
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
6144 g_list_free(wids);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6145 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6146
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6147 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6148
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6149 g_slist_free(smiley->anchors);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6150 smiley->anchors = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6151
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6152 g_object_unref(G_OBJECT(loader));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6153 smiley->loader = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6154 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6155
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6156 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6157 add_custom_smiley_for_imhtml(GtkIMHtml *imhtml, const char *sml, const char *smile)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6158 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6159 GtkIMHtmlSmiley *smiley;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6160 GdkPixbufLoader *loader;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6161
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6162 smiley = gtk_imhtml_smiley_get(imhtml, sml, smile);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6163
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6164 if (smiley) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6165
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6166 if (!(smiley->flags & GTK_IMHTML_SMILEY_CUSTOM)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6167 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6168 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6169
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6170 /* Close the old GdkPixbufAnimation, then create a new one for
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6171 * the smiley we are about to receive */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6172 g_object_unref(G_OBJECT(smiley->icon));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6173
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6174 /* XXX: Is it necessary to _unref the loader first? */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6175 smiley->loader = gdk_pixbuf_loader_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6176 smiley->icon = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6177
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6178 g_signal_connect(smiley->loader, "area_prepared", G_CALLBACK(pidgin_conv_custom_smiley_allocated), smiley);
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6179 g_signal_connect(smiley->loader, "closed", G_CALLBACK(pidgin_conv_custom_smiley_closed), smiley);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6180
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6181 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6182 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6183
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6184 loader = gdk_pixbuf_loader_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6185
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6186 /* this is wrong, this file ought not call g_new on GtkIMHtmlSmiley */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6187 /* Let gtk_imhtml have a gtk_imhtml_smiley_new function, and let
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6188 GtkIMHtmlSmiley by opaque */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6189 smiley = g_new0(GtkIMHtmlSmiley, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6190 smiley->file = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6191 smiley->smile = g_strdup(smile);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6192 smiley->loader = loader;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6193 smiley->flags = smiley->flags | GTK_IMHTML_SMILEY_CUSTOM;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6194
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6195 g_signal_connect(smiley->loader, "area_prepared", G_CALLBACK(pidgin_conv_custom_smiley_allocated), smiley);
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6196 g_signal_connect(smiley->loader, "closed", G_CALLBACK(pidgin_conv_custom_smiley_closed), smiley);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6197
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6198 gtk_imhtml_associate_smiley(imhtml, sml, smiley);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6199
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6200 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6201 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6202
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6203 static gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6204 pidgin_conv_custom_smiley_add(PurpleConversation *conv, const char *smile, gboolean remote)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6205 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6206 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6207 struct smiley_list *list;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6208 const char *sml = NULL, *conv_sml;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6209
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6210 if (!conv || !smile || !*smile) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6211 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6212 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6213
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6214 /* If smileys are off, return false */
16202
0973688f4b74 Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@wiktel.com>
parents: 16193
diff changeset
6215 if (pidgin_themes_smileys_disabled())
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6216 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6217
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6218 /* If possible add this smiley to the current theme.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6219 * The addition is only temporary: custom smilies aren't saved to disk. */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6220 conv_sml = purple_account_get_protocol_name(conv->account);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6221 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6222
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6223 for (list = (struct smiley_list *)current_smiley_theme->list; list; list = list->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6224 if (!strcmp(list->sml, conv_sml)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6225 sml = list->sml;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6226 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6227 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6228 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6229
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6230 if (!add_custom_smiley_for_imhtml(GTK_IMHTML(gtkconv->imhtml), sml, smile))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6231 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6232
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6233 if (!remote) /* If it's a local custom smiley, then add it for the entry */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6234 if (!add_custom_smiley_for_imhtml(GTK_IMHTML(gtkconv->entry), sml, smile))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6235 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6236
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6237 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6238 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6239
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6240 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6241 pidgin_conv_custom_smiley_write(PurpleConversation *conv, const char *smile,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6242 const guchar *data, gsize size)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6243 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6244 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6245 GtkIMHtmlSmiley *smiley;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6246 GdkPixbufLoader *loader;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6247 const char *sml;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6248
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6249 sml = purple_account_get_protocol_name(conv->account);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6250 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6251 smiley = gtk_imhtml_smiley_get(GTK_IMHTML(gtkconv->imhtml), sml, smile);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6252
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6253 if (!smiley)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6254 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6255
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6256 loader = smiley->loader;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6257 if (!loader)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6258 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6259
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6260 gdk_pixbuf_loader_write(loader, data, size, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6261 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6262
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6263 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6264 pidgin_conv_custom_smiley_close(PurpleConversation *conv, const char *smile)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6265 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6266 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6267 GtkIMHtmlSmiley *smiley;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6268 GdkPixbufLoader *loader;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6269 const char *sml;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6270
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6271 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6272 g_return_if_fail(smile != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6273
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6274 sml = purple_account_get_protocol_name(conv->account);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6275 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6276 smiley = gtk_imhtml_smiley_get(GTK_IMHTML(gtkconv->imhtml), sml, smile);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6277
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6278 if (!smiley)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6279 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6280
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6281 loader = smiley->loader;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6282
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6283 if (!loader)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6284 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6285
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6286
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6287
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6288 purple_debug_info("gtkconv", "About to close the smiley pixbuf\n");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6289
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6290 gdk_pixbuf_loader_close(loader, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6291
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6292 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6293
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6294 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6295 pidgin_conv_send_confirm(PurpleConversation *conv, const char *message)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6296 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6297 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6298
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6299 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->entry), message, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6300 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6301
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6302 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6303 * Makes sure all the menu items and all the buttons are hidden/shown and
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6304 * sensitive/insensitive. This is called after changing tabs and when an
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6305 * account signs on or off.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6306 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6307 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6308 gray_stuff_out(PidginConversation *gtkconv)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6309 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6310 PidginWindow *win;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6311 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6312 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6313 PurplePluginProtocolInfo *prpl_info = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6314 GdkPixbuf *window_icon = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6315 GtkIMHtmlButtons buttons;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6316 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6317
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6318 win = pidgin_conv_get_window(gtkconv);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6319 gc = purple_conversation_get_gc(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6320 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6321
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6322 if (gc != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6323 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6324
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6325 if (win->menu.send_to != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6326 update_send_to_selection(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6327
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6328 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6329 * Handle hiding and showing stuff based on what type of conv this is.
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6330 * Stuff that Purple IMs support in general should be shown for IM
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6331 * conversations. Stuff that Purple chats support in general should be
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6332 * shown for chat conversations. It doesn't matter whether the PRPL
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6333 * supports it or not--that only affects if the button or menu item
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6334 * is sensitive or not.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6335 */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6336 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6337 /* Show stuff that applies to IMs, hide stuff that applies to chats */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6338
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6339 /* Deal with menu items */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6340 gtk_widget_show(win->menu.view_log);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6341 gtk_widget_show(win->menu.send_file);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6342 gtk_widget_show(win->menu.add_pounce);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6343 gtk_widget_show(win->menu.get_info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6344 gtk_widget_hide(win->menu.invite);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6345 gtk_widget_show(win->menu.alias);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6346 if (purple_privacy_check(account, purple_conversation_get_name(conv))) {
15426
c9497aad9fc4 Warmenhoved patch #1397916: "Turns Block button in conv menu into Unblock after blocking" from Glauber de Oliveira Costa (glommer). You know the drill.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15374
diff changeset
6347 gtk_widget_hide(win->menu.unblock);
c9497aad9fc4 Warmenhoved patch #1397916: "Turns Block button in conv menu into Unblock after blocking" from Glauber de Oliveira Costa (glommer). You know the drill.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15374
diff changeset
6348 gtk_widget_show(win->menu.block);
c9497aad9fc4 Warmenhoved patch #1397916: "Turns Block button in conv menu into Unblock after blocking" from Glauber de Oliveira Costa (glommer). You know the drill.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15374
diff changeset
6349 } else {
c9497aad9fc4 Warmenhoved patch #1397916: "Turns Block button in conv menu into Unblock after blocking" from Glauber de Oliveira Costa (glommer). You know the drill.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15374
diff changeset
6350 gtk_widget_hide(win->menu.block);
c9497aad9fc4 Warmenhoved patch #1397916: "Turns Block button in conv menu into Unblock after blocking" from Glauber de Oliveira Costa (glommer). You know the drill.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15374
diff changeset
6351 gtk_widget_show(win->menu.unblock);
c9497aad9fc4 Warmenhoved patch #1397916: "Turns Block button in conv menu into Unblock after blocking" from Glauber de Oliveira Costa (glommer). You know the drill.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15374
diff changeset
6352 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6353
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6354 if ((account == NULL) || purple_find_buddy(account, purple_conversation_get_name(conv)) == NULL) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6355 gtk_widget_show(win->menu.add);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6356 gtk_widget_hide(win->menu.remove);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6357 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6358 gtk_widget_show(win->menu.remove);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6359 gtk_widget_hide(win->menu.add);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6360 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6361
17776
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
6362 gtk_widget_show(win->menu.insert_link);
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
6363 gtk_widget_show(win->menu.insert_image);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6364 } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6365 /* Show stuff that applies to Chats, hide stuff that applies to IMs */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6366
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6367 /* Deal with menu items */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6368 gtk_widget_show(win->menu.view_log);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6369 gtk_widget_hide(win->menu.send_file);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6370 gtk_widget_hide(win->menu.add_pounce);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6371 gtk_widget_hide(win->menu.get_info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6372 gtk_widget_show(win->menu.invite);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6373 gtk_widget_show(win->menu.alias);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6374 gtk_widget_hide(win->menu.block);
15555
883bf81c8d73 Hide the unblock menuitem for chats.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15465
diff changeset
6375 gtk_widget_hide(win->menu.unblock);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6376
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6377 if ((account == NULL) || purple_blist_find_chat(account, purple_conversation_get_name(conv)) == NULL) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6378 /* If the chat is NOT in the buddy list */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6379 gtk_widget_show(win->menu.add);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6380 gtk_widget_hide(win->menu.remove);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6381 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6382 /* If the chat IS in the buddy list */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6383 gtk_widget_hide(win->menu.add);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6384 gtk_widget_show(win->menu.remove);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6385 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6386
17776
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
6387 gtk_widget_show(win->menu.insert_link);
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
6388 gtk_widget_show(win->menu.insert_image);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6389 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6390
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6391 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6392 * Handle graying stuff out based on whether an account is connected
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6393 * and what features that account supports.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6394 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6395 if ((gc != NULL) &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6396 ((purple_conversation_get_type(conv) != PURPLE_CONV_TYPE_CHAT) ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6397 !purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv)) ))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6398 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6399 /* Account is online */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6400 /* Deal with the toolbar */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6401 if (conv->features & PURPLE_CONNECTION_HTML)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6402 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6403 buttons = GTK_IMHTML_ALL; /* Everything on */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6404 if (conv->features & PURPLE_CONNECTION_NO_BGCOLOR)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6405 buttons &= ~GTK_IMHTML_BACKCOLOR;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6406 if (conv->features & PURPLE_CONNECTION_NO_FONTSIZE)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6407 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6408 buttons &= ~GTK_IMHTML_GROW;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6409 buttons &= ~GTK_IMHTML_SHRINK;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6410 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6411 if (conv->features & PURPLE_CONNECTION_NO_URLDESC)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6412 buttons &= ~GTK_IMHTML_LINKDESC;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6413 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6414 buttons = GTK_IMHTML_SMILEY | GTK_IMHTML_IMAGE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6415 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6416
18167
b8b475f31008 Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <stu@nosnilmot.com>
parents: 18121
diff changeset
6417 if (!(prpl_info->options & OPT_PROTO_IM_IMAGE))
b8b475f31008 Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <stu@nosnilmot.com>
parents: 18121
diff changeset
6418 conv->features |= PURPLE_CONNECTION_NO_IMAGES;
b8b475f31008 Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <stu@nosnilmot.com>
parents: 18121
diff changeset
6419
b8b475f31008 Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <stu@nosnilmot.com>
parents: 18121
diff changeset
6420 if(conv->features & PURPLE_CONNECTION_NO_IMAGES)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6421 buttons &= ~GTK_IMHTML_IMAGE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6422
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6423 gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->entry), buttons);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6424 if (account != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6425 gtk_imhtmltoolbar_associate_smileys(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), purple_account_get_protocol_id(account));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6426
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6427 /* Deal with menu items */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6428 gtk_widget_set_sensitive(win->menu.view_log, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6429 gtk_widget_set_sensitive(win->menu.add_pounce, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6430 gtk_widget_set_sensitive(win->menu.get_info, (prpl_info->get_info != NULL));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6431 gtk_widget_set_sensitive(win->menu.invite, (prpl_info->chat_invite != NULL));
17776
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
6432 gtk_widget_set_sensitive(win->menu.insert_link, (conv->features & PURPLE_CONNECTION_HTML));
18167
b8b475f31008 Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <stu@nosnilmot.com>
parents: 18121
diff changeset
6433 gtk_widget_set_sensitive(win->menu.insert_image, !(conv->features & PURPLE_CONNECTION_NO_IMAGES));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6434
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6435 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6436 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6437 gtk_widget_set_sensitive(win->menu.add, (prpl_info->add_buddy != NULL));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6438 gtk_widget_set_sensitive(win->menu.remove, (prpl_info->remove_buddy != NULL));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6439 gtk_widget_set_sensitive(win->menu.send_file,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6440 (prpl_info->send_file != NULL && (!prpl_info->can_receive_file ||
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6441 prpl_info->can_receive_file(gc, purple_conversation_get_name(conv)))));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6442 gtk_widget_set_sensitive(win->menu.alias,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6443 (account != NULL) &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6444 (purple_find_buddy(account, purple_conversation_get_name(conv)) != NULL));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6445 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6446 else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6447 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6448 gtk_widget_set_sensitive(win->menu.add, (prpl_info->join_chat != NULL));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6449 gtk_widget_set_sensitive(win->menu.remove, (prpl_info->join_chat != NULL));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6450 gtk_widget_set_sensitive(win->menu.alias,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6451 (account != NULL) &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6452 (purple_blist_find_chat(account, purple_conversation_get_name(conv)) != NULL));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6453 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6454
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6455 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6456 /* Account is offline */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6457 /* Or it's a chat that we've left. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6458
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6459 /* Then deal with menu items */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6460 gtk_widget_set_sensitive(win->menu.view_log, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6461 gtk_widget_set_sensitive(win->menu.send_file, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6462 gtk_widget_set_sensitive(win->menu.add_pounce, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6463 gtk_widget_set_sensitive(win->menu.get_info, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6464 gtk_widget_set_sensitive(win->menu.invite, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6465 gtk_widget_set_sensitive(win->menu.alias, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6466 gtk_widget_set_sensitive(win->menu.add, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6467 gtk_widget_set_sensitive(win->menu.remove, FALSE);
17776
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
6468 gtk_widget_set_sensitive(win->menu.insert_link, TRUE);
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
6469 gtk_widget_set_sensitive(win->menu.insert_image, FALSE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6470 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6471
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6472 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6473 * Update the window's icon
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6474 */
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6475 if (pidgin_conv_window_is_active_conversation(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6476 {
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
6477 GList *l = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6478 if ((purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) &&
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6479 (gtkconv->u.im->anim))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6480 {
20183
dd4c3d712835 applied changes from 9d5a2f820265e4631d68d0f12a2def66acf36e3d
Richard Laager <rlaager@wiktel.com>
parents: 20028
diff changeset
6481 PurpleBuddy *buddy = purple_find_buddy(conv->account, conv->name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6482 window_icon =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6483 gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim);
20183
dd4c3d712835 applied changes from 9d5a2f820265e4631d68d0f12a2def66acf36e3d
Richard Laager <rlaager@wiktel.com>
parents: 20028
diff changeset
6484
dd4c3d712835 applied changes from 9d5a2f820265e4631d68d0f12a2def66acf36e3d
Richard Laager <rlaager@wiktel.com>
parents: 20028
diff changeset
6485 if (buddy && !PURPLE_BUDDY_IS_ONLINE(buddy))
dd4c3d712835 applied changes from 9d5a2f820265e4631d68d0f12a2def66acf36e3d
Richard Laager <rlaager@wiktel.com>
parents: 20028
diff changeset
6486 gdk_pixbuf_saturate_and_pixelate(window_icon, window_icon, 0.0, FALSE);
dd4c3d712835 applied changes from 9d5a2f820265e4631d68d0f12a2def66acf36e3d
Richard Laager <rlaager@wiktel.com>
parents: 20028
diff changeset
6487
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6488 g_object_ref(window_icon);
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
6489 l = g_list_append(l, window_icon);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6490 } else {
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
6491 l = pidgin_conv_get_tab_icons(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6492 }
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
6493 gtk_window_set_icon_list(GTK_WINDOW(win->window), l);
15749
74923b83e042 Fix a small leak
Sean Egan <seanegan@gmail.com>
parents: 15748
diff changeset
6494 if (window_icon != NULL) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6495 g_object_unref(G_OBJECT(window_icon));
15749
74923b83e042 Fix a small leak
Sean Egan <seanegan@gmail.com>
parents: 15748
diff changeset
6496 g_list_free(l);
74923b83e042 Fix a small leak
Sean Egan <seanegan@gmail.com>
parents: 15748
diff changeset
6497 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6498 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6499 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6500
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6501 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6502 pidgin_conv_update_fields(PurpleConversation *conv, PidginConvFields fields)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6503 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6504 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6505 PidginWindow *win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6506
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6507 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6508 if (!gtkconv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6509 return;
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6510 win = pidgin_conv_get_window(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6511 if (!win)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6512 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6513
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6514 if (fields & PIDGIN_CONV_SET_TITLE)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6515 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6516 purple_conversation_autoset_title(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6517 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6518
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6519 if (fields & PIDGIN_CONV_BUDDY_ICON)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6520 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6521 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM)
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6522 pidgin_conv_update_buddy_icon(conv);
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6523 }
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6524
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6525 if (fields & PIDGIN_CONV_MENU)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6526 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6527 gray_stuff_out(PIDGIN_CONVERSATION(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6528 generate_send_to_items(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6529 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6530
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6531 if (fields & PIDGIN_CONV_TAB_ICON)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6532 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6533 update_tab_icon(conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6534 generate_send_to_items(win); /* To update the icons in SendTo menu */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6535 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6536
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6537 if ((fields & PIDGIN_CONV_TOPIC) &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6538 purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6539 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6540 const char *topic;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6541 PurpleConvChat *chat = PURPLE_CONV_CHAT(conv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6542 PidginChatPane *gtkchat = gtkconv->u.chat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6543
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6544 if (gtkchat->topic_text != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6545 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6546 topic = purple_conv_chat_get_topic(chat);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6547
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6548 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), topic ? topic : "");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6549 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->topic_text,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6550 topic ? topic : "", NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6551 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6552 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6553
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6554 if (fields & PIDGIN_CONV_SMILEY_THEME)
16202
0973688f4b74 Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@wiktel.com>
parents: 16193
diff changeset
6555 pidgin_themes_smiley_themeize(PIDGIN_CONVERSATION(conv)->imhtml);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6556
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6557 if ((fields & PIDGIN_CONV_COLORIZE_TITLE) ||
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6558 (fields & PIDGIN_CONV_SET_TITLE) ||
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6559 (fields & PIDGIN_CONV_TOPIC))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6560 {
25542
92d8c9b08dab propagate from branch 'im.pidgin.pidgin' (head 90df17ab44d01f7f8f963d36fefb9eae3ec868cf)
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 19362 25541
diff changeset
6561 char *title, *title_tmp;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6562 PurpleConvIm *im = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6563 PurpleAccount *account = purple_conversation_get_account(conv);
18782
450a3dae477a Experimental tab-space-saving experiments. use text formatting instead of icons to represent status. Truncate buddy's names at a space or at-sign to make tabs more readable.
Sean Egan <seanegan@gmail.com>
parents: 18781
diff changeset
6564 PurpleBuddy *buddy = NULL;
450a3dae477a Experimental tab-space-saving experiments. use text formatting instead of icons to represent status. Truncate buddy's names at a space or at-sign to make tabs more readable.
Sean Egan <seanegan@gmail.com>
parents: 18781
diff changeset
6565 PurplePresence *p = NULL;
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6566 char *markup = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6567 AtkObject *accessibility_obj;
25508
e0add2aafeaf - merge nosuke's tab width patch.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 25504
diff changeset
6568 gboolean ellipsis = FALSE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6569 /* I think this is a little longer than it needs to be but I'm lazy. */
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
6570 char *style;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6571
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6572 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6573 im = PURPLE_CONV_IM(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6574
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6575 if ((account == NULL) ||
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6576 !purple_account_is_connected(account) ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6577 ((purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6578 && purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6579 title = g_strdup_printf("(%s)", purple_conversation_get_title(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6580 else
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6581 title = g_strdup(purple_conversation_get_title(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6582
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6583 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) {
18782
450a3dae477a Experimental tab-space-saving experiments. use text formatting instead of icons to represent status. Truncate buddy's names at a space or at-sign to make tabs more readable.
Sean Egan <seanegan@gmail.com>
parents: 18781
diff changeset
6584 buddy = purple_find_buddy(account, conv->name);
450a3dae477a Experimental tab-space-saving experiments. use text formatting instead of icons to represent status. Truncate buddy's names at a space or at-sign to make tabs more readable.
Sean Egan <seanegan@gmail.com>
parents: 18781
diff changeset
6585 if (buddy) {
450a3dae477a Experimental tab-space-saving experiments. use text formatting instead of icons to represent status. Truncate buddy's names at a space or at-sign to make tabs more readable.
Sean Egan <seanegan@gmail.com>
parents: 18781
diff changeset
6586 p = purple_buddy_get_presence(buddy);
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6587 markup = pidgin_blist_get_name_markup(buddy, FALSE, FALSE);
18782
450a3dae477a Experimental tab-space-saving experiments. use text formatting instead of icons to represent status. Truncate buddy's names at a space or at-sign to make tabs more readable.
Sean Egan <seanegan@gmail.com>
parents: 18781
diff changeset
6588 } else {
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6589 markup = title;
18782
450a3dae477a Experimental tab-space-saving experiments. use text formatting instead of icons to represent status. Truncate buddy's names at a space or at-sign to make tabs more readable.
Sean Egan <seanegan@gmail.com>
parents: 18781
diff changeset
6590 }
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6591 } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) {
21731
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
6592 const char *topic = gtkconv->u.chat->topic_text ? gtk_entry_get_text(GTK_ENTRY(gtkconv->u.chat->topic_text)) : NULL;
21710
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6593 char *esc = NULL;
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6594 #if GTK_CHECK_VERSION(2,6,0)
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6595 esc = topic ? g_markup_escape_text(topic, -1) : NULL;
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6596 #else
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6597 /* GTK < 2.6 doesn't have auto ellipsization, so we do a crude
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6598 * trucation to prevent forcing the window to be as wide as the topic */
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6599 int len = 0;
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6600 char *c, *tmp = g_strdup(topic);
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6601 c = tmp;
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6602 while(*c && len < 72) {
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6603 c = g_utf8_next_char(c);
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6604 len++;
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6605 }
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6606 if (len == 72) {
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6607 *c = '\0';
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6608 c = g_strdup_printf("%s...", tmp);
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6609 g_free(tmp);
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6610 tmp = c;
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6611 }
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6612 esc = tmp ? g_markup_escape_text(tmp, -1) : NULL;
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6613 g_free(tmp);
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6614 #endif
18290
2e7a9f33cfd3 Handle NULL chat topics
Sean Egan <seanegan@gmail.com>
parents: 18289
diff changeset
6615 markup = g_strdup_printf("%s%s<span color='%s' size='smaller'>%s</span>",
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6616 purple_conversation_get_title(conv),
19234
aafa9b36344e Double-click infopane to alias or change topic. Also, show alias instead of screenname in infopane
Sean Egan <seanegan@gmail.com>
parents: 19231
diff changeset
6617 esc && *esc ? "\n" : "",
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6618 pidgin_get_dim_grey_string(gtkconv->infopane),
19223
c8f18378045c Properly escape the chat-topics in the infopane. Fixes #1903.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18876
diff changeset
6619 esc ? esc : "");
c8f18378045c Properly escape the chat-topics in the infopane. Fixes #1903.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18876
diff changeset
6620 g_free(esc);
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6621 }
18181
a8c701d877aa Start work on blist pane in conversation. Looks like: http://pidgin.im/~seanegan/infopane.png Certainly much to be done yet.
Sean Egan <seanegan@gmail.com>
parents: 18167
diff changeset
6622 gtk_list_store_set(gtkconv->infopane_model, &(gtkconv->infopane_iter),
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
6623 CONV_TEXT_COLUMN, markup, -1);
19234
aafa9b36344e Double-click infopane to alias or change topic. Also, show alias instead of screenname in infopane
Sean Egan <seanegan@gmail.com>
parents: 19231
diff changeset
6624 /* XXX seanegan Why do I have to do this? */
20902
680e1319b464 Patch from Kramer to boldify the text in tab-titles when the user is typing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20842
diff changeset
6625 gtk_widget_queue_draw(gtkconv->infopane);
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6626
18181
a8c701d877aa Start work on blist pane in conversation. Looks like: http://pidgin.im/~seanegan/infopane.png Certainly much to be done yet.
Sean Egan <seanegan@gmail.com>
parents: 18167
diff changeset
6627 if (title != markup)
a8c701d877aa Start work on blist pane in conversation. Looks like: http://pidgin.im/~seanegan/infopane.png Certainly much to be done yet.
Sean Egan <seanegan@gmail.com>
parents: 18167
diff changeset
6628 g_free(markup);
a8c701d877aa Start work on blist pane in conversation. Looks like: http://pidgin.im/~seanegan/infopane.png Certainly much to be done yet.
Sean Egan <seanegan@gmail.com>
parents: 18167
diff changeset
6629
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6630 if (!GTK_WIDGET_REALIZED(gtkconv->tab_label))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6631 gtk_widget_realize(gtkconv->tab_label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6632
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6633 accessibility_obj = gtk_widget_get_accessible(gtkconv->tab_cont);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6634 if (im != NULL &&
18782
450a3dae477a Experimental tab-space-saving experiments. use text formatting instead of icons to represent status. Truncate buddy's names at a space or at-sign to make tabs more readable.
Sean Egan <seanegan@gmail.com>
parents: 18781
diff changeset
6635 purple_conv_im_get_typing_state(im) == PURPLE_TYPING) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6636 atk_object_set_description(accessibility_obj, _("Typing"));
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6637 style = "tab-label-typing";
18782
450a3dae477a Experimental tab-space-saving experiments. use text formatting instead of icons to represent status. Truncate buddy's names at a space or at-sign to make tabs more readable.
Sean Egan <seanegan@gmail.com>
parents: 18781
diff changeset
6638 } else if (im != NULL &&
450a3dae477a Experimental tab-space-saving experiments. use text formatting instead of icons to represent status. Truncate buddy's names at a space or at-sign to make tabs more readable.
Sean Egan <seanegan@gmail.com>
parents: 18781
diff changeset
6639 purple_conv_im_get_typing_state(im) == PURPLE_TYPED) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6640 atk_object_set_description(accessibility_obj, _("Stopped Typing"));
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6641 style = "tab-label-typed";
18782
450a3dae477a Experimental tab-space-saving experiments. use text formatting instead of icons to represent status. Truncate buddy's names at a space or at-sign to make tabs more readable.
Sean Egan <seanegan@gmail.com>
parents: 18781
diff changeset
6642 } else if (gtkconv->unseen_state == PIDGIN_UNSEEN_NICK) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6643 atk_object_set_description(accessibility_obj, _("Nick Said"));
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6644 style = "tab-label-attention";
18782
450a3dae477a Experimental tab-space-saving experiments. use text formatting instead of icons to represent status. Truncate buddy's names at a space or at-sign to make tabs more readable.
Sean Egan <seanegan@gmail.com>
parents: 18781
diff changeset
6645 } else if (gtkconv->unseen_state == PIDGIN_UNSEEN_TEXT) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6646 atk_object_set_description(accessibility_obj, _("Unread Messages"));
20920
ef44eb0859fe This is sure to be a controversial change... As I mentioned the other day
Richard Laager <rlaager@wiktel.com>
parents: 20902
diff changeset
6647 if (gtkconv->active_conv->type == PURPLE_CONV_TYPE_CHAT)
21704
a4b36b22ea94 New style.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21703
diff changeset
6648 style = "tab-label-unreadchat";
20920
ef44eb0859fe This is sure to be a controversial change... As I mentioned the other day
Richard Laager <rlaager@wiktel.com>
parents: 20902
diff changeset
6649 else
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6650 style = "tab-label-attention";
18782
450a3dae477a Experimental tab-space-saving experiments. use text formatting instead of icons to represent status. Truncate buddy's names at a space or at-sign to make tabs more readable.
Sean Egan <seanegan@gmail.com>
parents: 18781
diff changeset
6651 } else if (gtkconv->unseen_state == PIDGIN_UNSEEN_EVENT) {
450a3dae477a Experimental tab-space-saving experiments. use text formatting instead of icons to represent status. Truncate buddy's names at a space or at-sign to make tabs more readable.
Sean Egan <seanegan@gmail.com>
parents: 18781
diff changeset
6652 atk_object_set_description(accessibility_obj, _("New Event"));
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6653 style = "tab-label-event";
18782
450a3dae477a Experimental tab-space-saving experiments. use text formatting instead of icons to represent status. Truncate buddy's names at a space or at-sign to make tabs more readable.
Sean Egan <seanegan@gmail.com>
parents: 18781
diff changeset
6654 } else {
20902
680e1319b464 Patch from Kramer to boldify the text in tab-titles when the user is typing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20842
diff changeset
6655 style = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6656 }
20902
680e1319b464 Patch from Kramer to boldify the text in tab-titles when the user is typing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20842
diff changeset
6657
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6658 gtk_widget_set_name(gtkconv->tab_label, style);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6659 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6660 gtk_widget_set_state(gtkconv->tab_label, GTK_STATE_ACTIVE);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6661
20902
680e1319b464 Patch from Kramer to boldify the text in tab-titles when the user is typing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20842
diff changeset
6662 if (gtkconv->unseen_state == PIDGIN_UNSEEN_TEXT ||
680e1319b464 Patch from Kramer to boldify the text in tab-titles when the user is typing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20842
diff changeset
6663 gtkconv->unseen_state == PIDGIN_UNSEEN_NICK ||
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6664 gtkconv->unseen_state == PIDGIN_UNSEEN_EVENT) {
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6665 PangoAttrList *list = pango_attr_list_new();
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6666 PangoAttribute *attr = pango_attr_weight_new(PANGO_WEIGHT_BOLD);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6667 attr->start_index = 0;
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6668 attr->end_index = -1;
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6669 pango_attr_list_insert(list, attr);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6670 gtk_label_set_attributes(GTK_LABEL(gtkconv->tab_label), list);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6671 pango_attr_list_unref(list);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6672 } else
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6673 gtk_label_set_attributes(GTK_LABEL(gtkconv->tab_label), NULL);
20902
680e1319b464 Patch from Kramer to boldify the text in tab-titles when the user is typing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20842
diff changeset
6674
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6675 if (pidgin_conv_window_is_active_conversation(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6676 update_typing_icon(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6677
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6678 gtk_label_set_text(GTK_LABEL(gtkconv->menu_label), title);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6679 if (pidgin_conv_window_is_active_conversation(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6680 gtk_window_set_title(GTK_WINDOW(win->window), title);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6681
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6682 g_free(title);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6683 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6684 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6685
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6686 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6687 pidgin_conv_updated(PurpleConversation *conv, PurpleConvUpdateType type)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6688 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6689 PidginConvFields flags = 0;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6690
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6691 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6692
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6693 if (type == PURPLE_CONV_UPDATE_ACCOUNT)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6694 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6695 flags = PIDGIN_CONV_ALL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6696 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6697 else if (type == PURPLE_CONV_UPDATE_TYPING ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6698 type == PURPLE_CONV_UPDATE_UNSEEN ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6699 type == PURPLE_CONV_UPDATE_TITLE)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6700 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6701 flags = PIDGIN_CONV_COLORIZE_TITLE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6702 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6703 else if (type == PURPLE_CONV_UPDATE_TOPIC)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6704 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6705 flags = PIDGIN_CONV_TOPIC;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6706 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6707 else if (type == PURPLE_CONV_ACCOUNT_ONLINE ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6708 type == PURPLE_CONV_ACCOUNT_OFFLINE)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6709 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6710 flags = PIDGIN_CONV_MENU | PIDGIN_CONV_TAB_ICON | PIDGIN_CONV_SET_TITLE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6711 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6712 else if (type == PURPLE_CONV_UPDATE_AWAY)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6713 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6714 flags = PIDGIN_CONV_TAB_ICON;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6715 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6716 else if (type == PURPLE_CONV_UPDATE_ADD ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6717 type == PURPLE_CONV_UPDATE_REMOVE ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6718 type == PURPLE_CONV_UPDATE_CHATLEFT)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6719 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6720 flags = PIDGIN_CONV_SET_TITLE | PIDGIN_CONV_MENU;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6721 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6722 else if (type == PURPLE_CONV_UPDATE_ICON)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6723 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6724 flags = PIDGIN_CONV_BUDDY_ICON;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6725 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6726 else if (type == PURPLE_CONV_UPDATE_FEATURES)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6727 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6728 flags = PIDGIN_CONV_MENU;
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6729 }
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6730
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6731 pidgin_conv_update_fields(conv, flags);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6732 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6733
19900
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
6734 static void
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
6735 wrote_msg_update_unseen_cb(PurpleAccount *account, const char *who, const char *message,
20953
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
6736 PurpleConversation *conv, PurpleMessageFlags flags, gpointer null)
19900
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
6737 {
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
6738 if (conv == NULL || PIDGIN_IS_PIDGIN_CONVERSATION(conv))
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
6739 return;
20953
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
6740 if (flags & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV)) {
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
6741 PidginUnseenState unseen = PIDGIN_UNSEEN_NONE;
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
6742
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
6743 if ((flags & PURPLE_MESSAGE_NICK) == PURPLE_MESSAGE_NICK)
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
6744 unseen = PIDGIN_UNSEEN_NICK;
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
6745 else if (((flags & PURPLE_MESSAGE_SYSTEM) == PURPLE_MESSAGE_SYSTEM) ||
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
6746 ((flags & PURPLE_MESSAGE_ERROR) == PURPLE_MESSAGE_ERROR))
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
6747 unseen = PIDGIN_UNSEEN_EVENT;
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
6748 else if ((flags & PURPLE_MESSAGE_NO_LOG) == PURPLE_MESSAGE_NO_LOG)
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
6749 unseen = PIDGIN_UNSEEN_NO_LOG;
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
6750 else
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
6751 unseen = PIDGIN_UNSEEN_TEXT;
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
6752
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
6753 conv_set_unseen(conv, unseen);
19901
4fb981e14f64 Do not update the unseen count for system messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19900
diff changeset
6754 }
19900
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
6755 }
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
6756
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6757 static PurpleConversationUiOps conversation_ui_ops =
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6758 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6759 pidgin_conv_new,
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6760 pidgin_conv_destroy, /* destroy_conversation */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6761 NULL, /* write_chat */
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6762 pidgin_conv_write_im, /* write_im */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6763 pidgin_conv_write_conv, /* write_conv */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6764 pidgin_conv_chat_add_users, /* chat_add_users */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6765 pidgin_conv_chat_rename_user, /* chat_rename_user */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6766 pidgin_conv_chat_remove_users, /* chat_remove_users */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6767 pidgin_conv_chat_update_user, /* chat_update_user */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6768 pidgin_conv_present_conversation, /* present */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6769 pidgin_conv_has_focus, /* has_focus */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6770 pidgin_conv_custom_smiley_add, /* custom_smiley_add */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6771 pidgin_conv_custom_smiley_write, /* custom_smiley_write */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6772 pidgin_conv_custom_smiley_close, /* custom_smiley_close */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6773 pidgin_conv_send_confirm, /* send_confirm */
16681
fbf111436896 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16604
diff changeset
6774 NULL,
fbf111436896 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16604
diff changeset
6775 NULL,
fbf111436896 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16604
diff changeset
6776 NULL,
fbf111436896 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16604
diff changeset
6777 NULL
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6778 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6779
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6780 PurpleConversationUiOps *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6781 pidgin_conversations_get_conv_ui_ops(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6782 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6783 return &conversation_ui_ops;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6784 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6785
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6786 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6787 * Public conversation utility functions
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6788 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6789 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6790 pidgin_conv_update_buddy_icon(PurpleConversation *conv)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6791 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6792 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6793 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6794
16381
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6795 PurpleBuddy *buddy;
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6796
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6797 GdkPixbufLoader *loader;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6798 GdkPixbufAnimation *anim;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6799 GError *err = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6800
16381
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6801 PurpleStoredImage *custom_img = NULL;
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6802 gconstpointer data = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6803 size_t len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6804
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6805 GdkPixbuf *buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6806
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6807 GtkWidget *event;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6808 GdkPixbuf *scale;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6809 int scale_width, scale_height;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6810
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6811 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6812 PurplePluginProtocolInfo *prpl_info = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6813
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6814 PurpleBuddyIcon *icon;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6815
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6816 g_return_if_fail(conv != NULL);
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
6817 g_return_if_fail(PIDGIN_IS_PIDGIN_CONVERSATION(conv));
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6818 g_return_if_fail(purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6819
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6820 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6821 win = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6822 if (conv != gtkconv->active_conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6823 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6824
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6825 if (!gtkconv->u.im->show_icon)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6826 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6827
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6828 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6829 if(account && account->gc)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6830 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(account->gc->prpl);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6831
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6832 /* Remove the current icon stuff */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6833 if (gtkconv->u.im->icon_container != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6834 gtk_widget_destroy(gtkconv->u.im->icon_container);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6835 gtkconv->u.im->icon_container = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6836
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6837 if (gtkconv->u.im->anim != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6838 g_object_unref(G_OBJECT(gtkconv->u.im->anim));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6839
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6840 gtkconv->u.im->anim = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6841
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6842 if (gtkconv->u.im->icon_timer != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6843 g_source_remove(gtkconv->u.im->icon_timer);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6844
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6845 gtkconv->u.im->icon_timer = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6846
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6847 if (gtkconv->u.im->iter != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6848 g_object_unref(G_OBJECT(gtkconv->u.im->iter));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6849
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6850 gtkconv->u.im->iter = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6851
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
6852 if (!purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/im/show_buddy_icons"))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6853 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6854
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6855 if (purple_conversation_get_gc(conv) == NULL)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6856 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6857
16381
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6858 buddy = purple_find_buddy(account, purple_conversation_get_name(conv));
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6859 if (buddy)
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6860 {
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6861 PurpleContact *contact = purple_buddy_get_contact(buddy);
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6862 if (contact) {
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6863 custom_img = purple_buddy_icons_find_custom_icon(contact);
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6864 if (custom_img) {
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6865 /* There is a custom icon for this user */
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6866 data = purple_imgstore_get_data(custom_img);
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6867 len = purple_imgstore_get_size(custom_img);
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6868 }
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6869 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6870 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6871
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6872 if (data == NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6873 icon = purple_conv_im_get_icon(PURPLE_CONV_IM(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6874
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6875 if (icon == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6876 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6877
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6878 data = purple_buddy_icon_get_data(icon, &len);
16381
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6879
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6880 if (data == NULL)
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6881 return;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6882 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6883
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6884 loader = gdk_pixbuf_loader_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6885 gdk_pixbuf_loader_write(loader, data, len, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6886 gdk_pixbuf_loader_close(loader, &err);
16383
05033ae856b2 Fix the memory leaking and improper calls to ref_filename(). Also, remove some debugging code.
Richard Laager <rlaager@wiktel.com>
parents: 16381
diff changeset
6887
05033ae856b2 Fix the memory leaking and improper calls to ref_filename(). Also, remove some debugging code.
Richard Laager <rlaager@wiktel.com>
parents: 16381
diff changeset
6888 purple_imgstore_unref(custom_img);
05033ae856b2 Fix the memory leaking and improper calls to ref_filename(). Also, remove some debugging code.
Richard Laager <rlaager@wiktel.com>
parents: 16381
diff changeset
6889
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6890 anim = gdk_pixbuf_loader_get_animation(loader);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6891 if (anim)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6892 g_object_ref(G_OBJECT(anim));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6893 g_object_unref(loader);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6894
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6895 if (!anim)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6896 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6897 gtkconv->u.im->anim = anim;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6898
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6899 if (err) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6900 purple_debug(PURPLE_DEBUG_ERROR, "gtkconv",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6901 "Buddy icon error: %s\n", err->message);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6902 g_error_free(err);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6903 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6904
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6905 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) {
18213
270e87f5cde0 Round the other icons too
Sean Egan <seanegan@gmail.com>
parents: 18212
diff changeset
6906 GdkPixbuf *stat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6907 gtkconv->u.im->iter = NULL;
18213
270e87f5cde0 Round the other icons too
Sean Egan <seanegan@gmail.com>
parents: 18212
diff changeset
6908 stat = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim);
270e87f5cde0 Round the other icons too
Sean Egan <seanegan@gmail.com>
parents: 18212
diff changeset
6909 buf = gdk_pixbuf_add_alpha(stat, FALSE, 0, 0, 0);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6910 } else {
18213
270e87f5cde0 Round the other icons too
Sean Egan <seanegan@gmail.com>
parents: 18212
diff changeset
6911 GdkPixbuf *stat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6912 gtkconv->u.im->iter =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6913 gdk_pixbuf_animation_get_iter(gtkconv->u.im->anim, NULL); /* LEAK */
18213
270e87f5cde0 Round the other icons too
Sean Egan <seanegan@gmail.com>
parents: 18212
diff changeset
6914 stat = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter);
270e87f5cde0 Round the other icons too
Sean Egan <seanegan@gmail.com>
parents: 18212
diff changeset
6915 buf = gdk_pixbuf_add_alpha(stat, FALSE, 0, 0, 0);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6916 if (gtkconv->u.im->animate)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6917 start_anim(NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6918 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6919
18214
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
6920 scale_width = gdk_pixbuf_get_width(buf);
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
6921 scale_height = gdk_pixbuf_get_height(buf);
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
6922 if (scale_width == scale_height) {
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
6923 scale_width = scale_height = 32;
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
6924 } else if (scale_height > scale_width) {
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
6925 scale_width = 32 * scale_width / scale_height;
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
6926 scale_height = 32;
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
6927 } else {
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
6928 scale_height = 32 * scale_height / scale_width;
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
6929 scale_width = 32;
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
6930 }
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
6931 scale = gdk_pixbuf_scale_simple(buf, scale_width, scale_height,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6932 GDK_INTERP_BILINEAR);
18213
270e87f5cde0 Round the other icons too
Sean Egan <seanegan@gmail.com>
parents: 18212
diff changeset
6933 g_object_unref(buf);
18212
77b9ceb83426 Rounds icons in the infopane. Since gdk_pixbuf_animation_get_static_image seems to return pixbufs without alpha channels, this only rounds animated icons that aren't transparent.
Sean Egan <seanegan@gmail.com>
parents: 18211
diff changeset
6934 if (pidgin_gdk_pixbuf_is_opaque(scale))
77b9ceb83426 Rounds icons in the infopane. Since gdk_pixbuf_animation_get_static_image seems to return pixbufs without alpha channels, this only rounds animated icons that aren't transparent.
Sean Egan <seanegan@gmail.com>
parents: 18211
diff changeset
6935 pidgin_gdk_pixbuf_make_round(scale);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6936 gtkconv->u.im->icon_container = gtk_vbox_new(FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6937
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6938 event = gtk_event_box_new();
18181
a8c701d877aa Start work on blist pane in conversation. Looks like: http://pidgin.im/~seanegan/infopane.png Certainly much to be done yet.
Sean Egan <seanegan@gmail.com>
parents: 18167
diff changeset
6939 gtk_container_add(GTK_CONTAINER(gtkconv->u.im->icon_container), event);
20286
0ce367508ab6 Fix for compiling with Gtk < 2.4, references #3144
Stu Tomlinson <stu@nosnilmot.com>
parents: 20251
diff changeset
6940 #if GTK_CHECK_VERSION(2,4,0)
18821
0765cf9331f6 warning fixes
Sean Egan <seanegan@gmail.com>
parents: 18820
diff changeset
6941 gtk_event_box_set_visible_window(GTK_EVENT_BOX(event), FALSE);
20286
0ce367508ab6 Fix for compiling with Gtk < 2.4, references #3144
Stu Tomlinson <stu@nosnilmot.com>
parents: 20251
diff changeset
6942 #endif
18781
8b0663abb488 add tooltip to buddy icon in conversation too
Sean Egan <seanegan@gmail.com>
parents: 18779
diff changeset
6943 gtk_widget_add_events(event,
8b0663abb488 add tooltip to buddy icon in conversation too
Sean Egan <seanegan@gmail.com>
parents: 18779
diff changeset
6944 GDK_POINTER_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6945 g_signal_connect(G_OBJECT(event), "button-press-event",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6946 G_CALLBACK(icon_menu), gtkconv);
19226
a0d45fa8ecfc De-seaneganify some of the indentation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19223
diff changeset
6947 g_signal_connect(G_OBJECT(event), "motion-notify-event",
a0d45fa8ecfc De-seaneganify some of the indentation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19223
diff changeset
6948 G_CALLBACK(pidgin_conv_motion_cb), gtkconv);
a0d45fa8ecfc De-seaneganify some of the indentation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19223
diff changeset
6949 g_signal_connect(G_OBJECT(event), "leave-notify-event",
a0d45fa8ecfc De-seaneganify some of the indentation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19223
diff changeset
6950 G_CALLBACK(pidgin_conv_leave_cb), gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6951 gtk_widget_show(event);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6952
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6953 gtkconv->u.im->icon = gtk_image_new_from_pixbuf(scale);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6954 gtk_container_add(GTK_CONTAINER(event), gtkconv->u.im->icon);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6955 gtk_widget_show(gtkconv->u.im->icon);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6956
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6957 g_object_unref(G_OBJECT(scale));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6958
18181
a8c701d877aa Start work on blist pane in conversation. Looks like: http://pidgin.im/~seanegan/infopane.png Certainly much to be done yet.
Sean Egan <seanegan@gmail.com>
parents: 18167
diff changeset
6959 gtk_box_pack_start(GTK_BOX(gtkconv->infopane_hbox),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6960 gtkconv->u.im->icon_container, FALSE, FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6961
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6962 gtk_widget_show(gtkconv->u.im->icon_container);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6963
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6964 /* The buddy icon code needs badly to be fixed. */
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6965 if(pidgin_conv_window_is_active_conversation(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6966 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6967 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6968 gtk_window_set_icon(GTK_WINDOW(win->window), buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6969 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6970 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6971
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6972 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6973 pidgin_conv_update_buttons_by_protocol(PurpleConversation *conv)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6974 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6975 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6976
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
6977 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6978 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6979
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6980 win = PIDGIN_CONVERSATION(conv)->win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6981
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6982 if (win != NULL && pidgin_conv_window_is_active_conversation(conv))
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6983 gray_stuff_out(PIDGIN_CONVERSATION(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6984 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6985
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6986 int
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6987 pidgin_conv_get_tab_at_xy(PidginWindow *win, int x, int y, gboolean *to_right)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6988 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6989 gint nb_x, nb_y, x_rel, y_rel;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6990 GtkNotebook *notebook;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6991 GtkWidget *page, *tab;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6992 gint i, page_num = -1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6993 gint count;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6994 gboolean horiz;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6995
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6996 if (to_right)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6997 *to_right = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6998
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6999 notebook = GTK_NOTEBOOK(win->notebook);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7000
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7001 gdk_window_get_origin(win->notebook->window, &nb_x, &nb_y);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7002 x_rel = x - nb_x;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7003 y_rel = y - nb_y;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7004
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7005 horiz = (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7006 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7007
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7008 #if GTK_CHECK_VERSION(2,2,0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7009 count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(notebook));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7010 #else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7011 /* this is hacky, but it's only for Gtk 2.0.0... */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7012 count = g_list_length(GTK_NOTEBOOK(notebook)->children);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7013 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7014
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7015 for (i = 0; i < count; i++) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7016
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7017 page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), i);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7018 tab = gtk_notebook_get_tab_label(GTK_NOTEBOOK(notebook), page);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7019
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7020 /* Make sure the tab is not hidden beyond an arrow */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7021 if (!GTK_WIDGET_DRAWABLE(tab))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7022 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7023
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7024 if (horiz) {
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
7025 if (x_rel >= tab->allocation.x - PIDGIN_HIG_BOX_SPACE &&
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
7026 x_rel <= tab->allocation.x + tab->allocation.width + PIDGIN_HIG_BOX_SPACE) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7027 page_num = i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7028
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7029 if (to_right && x_rel >= tab->allocation.x + tab->allocation.width/2)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7030 *to_right = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7031
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7032 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7033 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7034 } else {
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
7035 if (y_rel >= tab->allocation.y - PIDGIN_HIG_BOX_SPACE &&
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
7036 y_rel <= tab->allocation.y + tab->allocation.height + PIDGIN_HIG_BOX_SPACE) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7037 page_num = i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7038
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7039 if (to_right && y_rel >= tab->allocation.y + tab->allocation.height/2)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7040 *to_right = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7041
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7042 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7043 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7044 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7045 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7046
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7047 if (page_num == -1) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7048 /* Add after the last tab */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7049 page_num = count - 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7050 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7051
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7052 return page_num;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7053 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7054
25508
e0add2aafeaf - merge nosuke's tab width patch.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 25504
diff changeset
7055 //nosuke
e0add2aafeaf - merge nosuke's tab width patch.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 25504
diff changeset
7056 static void
e0add2aafeaf - merge nosuke's tab width patch.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 25504
diff changeset
7057 trim_vertical_tabs_pref_cb(const char *name, PurplePrefType type,
e0add2aafeaf - merge nosuke's tab width patch.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 25504
diff changeset
7058 gconstpointer value, gpointer data)
e0add2aafeaf - merge nosuke's tab width patch.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 25504
diff changeset
7059 {
e0add2aafeaf - merge nosuke's tab width patch.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 25504
diff changeset
7060 GList *l;
e0add2aafeaf - merge nosuke's tab width patch.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 25504
diff changeset
7061 PurpleConversation *conv;
e0add2aafeaf - merge nosuke's tab width patch.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 25504
diff changeset
7062
e0add2aafeaf - merge nosuke's tab width patch.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 25504
diff changeset
7063 for (l = purple_get_conversations(); l != NULL; l = l->next) {
e0add2aafeaf - merge nosuke's tab width patch.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 25504
diff changeset
7064 conv = (PurpleConversation *)l->data;
e0add2aafeaf - merge nosuke's tab width patch.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 25504
diff changeset
7065
e0add2aafeaf - merge nosuke's tab width patch.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 25504
diff changeset
7066 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
e0add2aafeaf - merge nosuke's tab width patch.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 25504
diff changeset
7067 continue;
e0add2aafeaf - merge nosuke's tab width patch.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 25504
diff changeset
7068
e0add2aafeaf - merge nosuke's tab width patch.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 25504
diff changeset
7069 pidgin_conv_update_fields(conv, PIDGIN_CONV_SET_TITLE);
e0add2aafeaf - merge nosuke's tab width patch.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 25504
diff changeset
7070 }
e0add2aafeaf - merge nosuke's tab width patch.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 25504
diff changeset
7071 }
e0add2aafeaf - merge nosuke's tab width patch.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 25504
diff changeset
7072
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7073 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7074 close_on_tabs_pref_cb(const char *name, PurplePrefType type,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7075 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7076 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
7077 GList *l;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7078 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7079 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7080
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7081 for (l = purple_get_conversations(); l != NULL; l = l->next) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7082 conv = (PurpleConversation *)l->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7083
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
7084 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7085 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7086
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7087 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7088
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7089 if (value)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7090 gtk_widget_show(gtkconv->close);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7091 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7092 gtk_widget_hide(gtkconv->close);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7093 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7094 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7095
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7096 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7097 spellcheck_pref_cb(const char *name, PurplePrefType type,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7098 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7099 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7100 #ifdef USE_GTKSPELL
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
7101 GList *cl;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7102 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7103 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7104 GtkSpell *spell;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7105
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7106 for (cl = purple_get_conversations(); cl != NULL; cl = cl->next) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7107
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7108 conv = (PurpleConversation *)cl->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7109
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
7110 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7111 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7112
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7113 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7114
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7115 if (value)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7116 pidgin_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7117 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7118 spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(gtkconv->entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7119 gtkspell_detach(spell);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7120 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7121 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7122 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7123 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7124
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7125 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7126 tab_side_pref_cb(const char *name, PurplePrefType type,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7127 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7128 {
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
7129 GList *gtkwins, *gtkconvs;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7130 GtkPositionType pos;
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
7131 PidginWindow *gtkwin;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7132
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7133 pos = GPOINTER_TO_INT(value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7134
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
7135 for (gtkwins = pidgin_conv_windows_get_list(); gtkwins != NULL; gtkwins = gtkwins->next) {
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
7136 gtkwin = gtkwins->data;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
7137 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos&~8);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
7138 for (gtkconvs = gtkwin->gtkconvs; gtkconvs != NULL; gtkconvs = gtkconvs->next) {
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
7139 pidgin_conv_tab_pack(gtkwin, gtkconvs->data);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
7140 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7141 }
25508
e0add2aafeaf - merge nosuke's tab width patch.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 25504
diff changeset
7142 trim_vertical_tabs_pref_cb(name, type, value, data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7143 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7144
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7145 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7146 show_timestamps_pref_cb(const char *name, PurplePrefType type,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7147 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7148 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
7149 GList *l;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7150 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7151 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7152 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7153
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7154 for (l = purple_get_conversations(); l != NULL; l = l->next)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7155 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7156 conv = (PurpleConversation *)l->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7157
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
7158 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7159 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7160
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7161 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7162 win = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7163
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7164 gtk_check_menu_item_set_active(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7165 GTK_CHECK_MENU_ITEM(win->menu.show_timestamps),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7166 (gboolean)GPOINTER_TO_INT(value));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7167
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7168 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7169 (gboolean)GPOINTER_TO_INT(value));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7170 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7171 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7172
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7173 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7174 show_formatting_toolbar_pref_cb(const char *name, PurplePrefType type,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7175 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7176 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
7177 GList *l;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7178 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7179 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7180 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7181
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7182 for (l = purple_get_conversations(); l != NULL; l = l->next)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7183 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7184 conv = (PurpleConversation *)l->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7185
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
7186 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7187 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7188
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7189 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7190 win = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7191
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7192 gtk_check_menu_item_set_active(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7193 GTK_CHECK_MENU_ITEM(win->menu.show_formatting_toolbar),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7194 (gboolean)GPOINTER_TO_INT(value));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7195
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7196 if ((gboolean)GPOINTER_TO_INT(value))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7197 gtk_widget_show(gtkconv->toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7198 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7199 gtk_widget_hide(gtkconv->toolbar);
21661
7dff569f2a6e Earlier, resiak and khc agreed that we're better off without the resizable paned widget in the gtkconv.
Sean Egan <seanegan@gmail.com>
parents: 21573
diff changeset
7200
21665
baa25b613999 Clean up warnings
Sean Egan <seanegan@gmail.com>
parents: 21664
diff changeset
7201 g_idle_add((GSourceFunc)resize_imhtml_cb,gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7202 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7203 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7204
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7205 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7206 animate_buddy_icons_pref_cb(const char *name, PurplePrefType type,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7207 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7208 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
7209 GList *l;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7210 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7211 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7212 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7213
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7214 if (!purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/im/show_buddy_icons"))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7215 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7216
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7217 /* Set the "animate" flag for each icon based on the new preference */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7218 for (l = purple_get_ims(); l != NULL; l = l->next) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7219 conv = (PurpleConversation *)l->data;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7220 gtkconv = PIDGIN_CONVERSATION(conv);
19616
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
7221 if (gtkconv)
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
7222 gtkconv->u.im->animate = GPOINTER_TO_INT(value);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7223 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7224
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7225 /* Now either stop or start animation for the active conversation in each window */
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7226 for (l = pidgin_conv_windows_get_list(); l != NULL; l = l->next) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7227 win = l->data;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7228 conv = pidgin_conv_window_get_active_conversation(win);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7229 pidgin_conv_update_buddy_icon(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7230 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7231 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7232
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7233 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7234 show_buddy_icons_pref_cb(const char *name, PurplePrefType type,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7235 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7236 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
7237 GList *l;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7238
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7239 for (l = purple_get_conversations(); l != NULL; l = l->next) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7240 PurpleConversation *conv = l->data;
19616
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
7241 if (!PIDGIN_CONVERSATION(conv))
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
7242 continue;
18602
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7243 if (GPOINTER_TO_INT(value))
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7244 gtk_widget_show(PIDGIN_CONVERSATION(conv)->infopane_hbox);
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7245 else
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7246 gtk_widget_hide(PIDGIN_CONVERSATION(conv)->infopane_hbox);
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7247
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7248 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7249 pidgin_conv_update_buddy_icon(conv);
18602
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7250 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7251 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7252 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7253
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7254 static void
19474
74befdcd0454 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@gmail.com>
parents: 19468
diff changeset
7255 show_protocol_icons_pref_cb(const char *name, PurplePrefType type,
74befdcd0454 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@gmail.com>
parents: 19468
diff changeset
7256 gconstpointer value, gpointer data)
74befdcd0454 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@gmail.com>
parents: 19468
diff changeset
7257 {
74befdcd0454 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@gmail.com>
parents: 19468
diff changeset
7258 GList *l;
74befdcd0454 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@gmail.com>
parents: 19468
diff changeset
7259 for (l = purple_get_conversations(); l != NULL; l = l->next) {
74befdcd0454 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@gmail.com>
parents: 19468
diff changeset
7260 PurpleConversation *conv = l->data;
19616
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
7261 if (PIDGIN_CONVERSATION(conv))
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
7262 update_tab_icon(conv);
19474
74befdcd0454 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@gmail.com>
parents: 19468
diff changeset
7263 }
74befdcd0454 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@gmail.com>
parents: 19468
diff changeset
7264 }
74befdcd0454 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@gmail.com>
parents: 19468
diff changeset
7265
74befdcd0454 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@gmail.com>
parents: 19468
diff changeset
7266 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7267 conv_placement_usetabs_cb(const char *name, PurplePrefType type,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7268 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7269 {
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7270 purple_prefs_trigger_callback(PIDGIN_PREFS_ROOT "/conversations/placement");
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7271 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7272
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7273 static void
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7274 account_status_changed_cb(PurpleAccount *account, PurpleStatus *oldstatus,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7275 PurpleStatus *newstatus)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7276 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7277 GList *l;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7278 PurpleConversation *conv = NULL;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7279 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7280
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7281 if(strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/im/hide_new"), "away")!=0)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7282 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7283
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7284 if(purple_status_is_available(oldstatus) || !purple_status_is_available(newstatus))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7285 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7286
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7287 while ((l = hidden_convwin->gtkconvs) != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7288 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7289 gtkconv = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7290
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7291 conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7292
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7293 while(l && !purple_status_is_available(
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7294 purple_account_get_active_status(
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7295 purple_conversation_get_account(conv))))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7296 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7297 if (!l)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7298 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7299
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7300 pidgin_conv_window_remove_gtkconv(hidden_convwin, gtkconv);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7301 pidgin_conv_placement_place(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7302
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7303 /* TODO: do we need to do anything for any other conversations that are in the same gtkconv here?
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7304 * I'm a little concerned that not doing so will cause the "pending" indicator in the gtkblist not to be cleared. -DAA*/
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7305 purple_conversation_update(conv, PURPLE_CONV_UPDATE_UNSEEN);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7306 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7307 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7308
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7309 static void
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7310 hide_new_pref_cb(const char *name, PurplePrefType type,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7311 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7312 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7313 GList *l;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7314 PurpleConversation *conv = NULL;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7315 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7316 gboolean when_away = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7317
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7318 if(!hidden_convwin)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7319 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7320
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7321 if(strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/im/hide_new"), "always")==0)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7322 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7323
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7324 if(strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/im/hide_new"), "away")==0)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7325 when_away = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7326
21765
8922d61c738a Fix a bug when changing 'close new ims' to always, then to never.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21731
diff changeset
7327 for (l = hidden_convwin->gtkconvs; l; )
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7328 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7329 gtkconv = l->data;
21765
8922d61c738a Fix a bug when changing 'close new ims' to always, then to never.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21731
diff changeset
7330 l = l->next;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7331
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7332 conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7333
21765
8922d61c738a Fix a bug when changing 'close new ims' to always, then to never.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21731
diff changeset
7334 if (conv->type == PURPLE_CONV_TYPE_CHAT ||
8922d61c738a Fix a bug when changing 'close new ims' to always, then to never.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21731
diff changeset
7335 gtkconv->unseen_count == 0 ||
8922d61c738a Fix a bug when changing 'close new ims' to always, then to never.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21731
diff changeset
7336 (when_away && !purple_status_is_available(
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7337 purple_account_get_active_status(
21765
8922d61c738a Fix a bug when changing 'close new ims' to always, then to never.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21731
diff changeset
7338 purple_conversation_get_account(conv)))))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7339 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7340
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7341 pidgin_conv_window_remove_gtkconv(hidden_convwin, gtkconv);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7342 pidgin_conv_placement_place(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7343 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7344 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7345
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7346
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7347 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7348 conv_placement_pref_cb(const char *name, PurplePrefType type,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7349 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7350 {
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
7351 PidginConvPlacementFunc func;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7352
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7353 if (strcmp(name, PIDGIN_PREFS_ROOT "/conversations/placement"))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7354 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7355
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7356 func = pidgin_conv_placement_get_fnc(value);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7357
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7358 if (func == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7359 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7360
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7361 pidgin_conv_placement_set_current_func(func);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7362 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7363
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7364 static PidginConversation *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7365 get_gtkconv_with_contact(PurpleContact *contact)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7366 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7367 PurpleBlistNode *node;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7368
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7369 node = ((PurpleBlistNode*)contact)->child;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7370
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7371 for (; node; node = node->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7372 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7373 PurpleBuddy *buddy = (PurpleBuddy*)node;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7374 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7375 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddy->name, buddy->account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7376 if (conv)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7377 return PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7378 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7379 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7380 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7381
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7382 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7383 account_signed_off_cb(PurpleConnection *gc, gpointer event)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7384 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
7385 GList *iter;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7386
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7387 for (iter = purple_get_conversations(); iter; iter = iter->next)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7388 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7389 PurpleConversation *conv = iter->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7390
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7391 /* This seems fine in theory, but we also need to cover the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7392 * case of this account matching one of the other buddies in
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7393 * one of the contacts containing the buddy corresponding to
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7394 * a conversation. It's easier to just update them all. */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7395 /* if (purple_conversation_get_account(conv) == account) */
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7396 pidgin_conv_update_fields(conv, PIDGIN_CONV_TAB_ICON |
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7397 PIDGIN_CONV_MENU | PIDGIN_CONV_COLORIZE_TITLE);
20552
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7398
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7399 if (PURPLE_CONNECTION_IS_CONNECTED(gc) &&
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7400 conv->type == PURPLE_CONV_TYPE_CHAT &&
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7401 conv->account == gc->account &&
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7402 purple_conversation_get_data(conv, "want-to-rejoin")) {
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7403 GHashTable *comps = NULL;
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7404 PurpleChat *chat = purple_blist_find_chat(conv->account, conv->name);
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7405 if (chat == NULL) {
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7406 if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults != NULL)
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7407 comps = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults(gc, conv->name);
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7408 } else {
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7409 comps = chat->components;
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7410 }
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7411 serv_join_chat(gc, comps);
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7412 if (chat == NULL && comps != NULL)
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7413 g_hash_table_destroy(comps);
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7414 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7415 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7416 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7417
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7418 static gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7419 update_buddy_status_timeout(PurpleBuddy *buddy)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7420 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7421 /* To remove the signing-on/off door icon */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7422 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7423
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7424 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddy->name, buddy->account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7425 if (conv)
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7426 pidgin_conv_update_fields(conv, PIDGIN_CONV_TAB_ICON);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7427
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7428 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7429 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7430
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7431 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7432 update_buddy_status_changed(PurpleBuddy *buddy, PurpleStatus *old, PurpleStatus *newstatus)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7433 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7434 PidginConversation *gtkconv;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7435 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7436
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7437 gtkconv = get_gtkconv_with_contact(purple_buddy_get_contact(buddy));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7438 if (gtkconv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7439 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7440 conv = gtkconv->active_conv;
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7441 pidgin_conv_update_fields(conv, PIDGIN_CONV_TAB_ICON | PIDGIN_CONV_COLORIZE_TITLE);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7442 if ((purple_status_is_online(old) ^ purple_status_is_online(newstatus)) != 0)
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7443 pidgin_conv_update_fields(conv, PIDGIN_CONV_MENU);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7444 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7445
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7446 /* In case a conversation is started after the buddy has signed-on/off */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7447 g_timeout_add(11000, (GSourceFunc)update_buddy_status_timeout, buddy);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7448 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7449
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7450 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7451 update_buddy_privacy_changed(PurpleBuddy *buddy)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7452 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7453 PidginConversation *gtkconv;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7454 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7455
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7456 gtkconv = get_gtkconv_with_contact(purple_buddy_get_contact(buddy));
15426
c9497aad9fc4 Warmenhoved patch #1397916: "Turns Block button in conv menu into Unblock after blocking" from Glauber de Oliveira Costa (glommer). You know the drill.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15374
diff changeset
7457 if (gtkconv) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7458 conv = gtkconv->active_conv;
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7459 pidgin_conv_update_fields(conv, PIDGIN_CONV_TAB_ICON | PIDGIN_CONV_MENU);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7460 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7461 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7462
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7463 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7464 update_buddy_idle_changed(PurpleBuddy *buddy, gboolean old, gboolean newidle)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7465 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7466 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7467
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7468 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddy->name, buddy->account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7469 if (conv)
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7470 pidgin_conv_update_fields(conv, PIDGIN_CONV_TAB_ICON);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7471 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7472
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7473 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7474 update_buddy_icon(PurpleBuddy *buddy)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7475 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7476 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7477
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7478 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddy->name, buddy->account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7479 if (conv)
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7480 pidgin_conv_update_fields(conv, PIDGIN_CONV_BUDDY_ICON);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7481 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7482
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7483 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7484 update_buddy_sign(PurpleBuddy *buddy, const char *which)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7485 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7486 PurplePresence *presence;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7487 PurpleStatus *on, *off;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7488
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7489 presence = purple_buddy_get_presence(buddy);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7490 if (!presence)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7491 return;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7492 off = purple_presence_get_status(presence, "offline");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7493 on = purple_presence_get_status(presence, "available");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7494
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7495 if (*(which+1) == 'f')
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7496 update_buddy_status_changed(buddy, on, off);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7497 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7498 update_buddy_status_changed(buddy, off, on);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7499 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7500
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7501 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7502 update_conversation_switched(PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7503 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7504 pidgin_conv_update_fields(conv, PIDGIN_CONV_TAB_ICON | PIDGIN_CONV_SET_TITLE |
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7505 PIDGIN_CONV_MENU | PIDGIN_CONV_BUDDY_ICON);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7506 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7507
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7508 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7509 update_buddy_typing(PurpleAccount *account, const char *who)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7510 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7511 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7512 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7513
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7514 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7515 if (!conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7516 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7517
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7518 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7519 if (gtkconv && gtkconv->active_conv == conv)
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7520 pidgin_conv_update_fields(conv, PIDGIN_CONV_COLORIZE_TITLE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7521 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7522
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7523 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7524 update_chat(PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7525 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7526 pidgin_conv_update_fields(conv, PIDGIN_CONV_TOPIC |
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7527 PIDGIN_CONV_MENU | PIDGIN_CONV_SET_TITLE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7528 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7529
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7530 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7531 update_chat_topic(PurpleConversation *conv, const char *old, const char *new)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7532 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7533 pidgin_conv_update_fields(conv, PIDGIN_CONV_TOPIC);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7534 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7535
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7536 /* Message history stuff */
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7537
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7538 /* Compare two PurpleConvMessage's, according to time in ascending order. */
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7539 static int
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7540 message_compare(gconstpointer p1, gconstpointer p2)
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7541 {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7542 const PurpleConvMessage *m1 = p1, *m2 = p2;
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7543 return (m1->when > m2->when);
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7544 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7545
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7546 /* Adds some message history to the gtkconv. This happens in a idle-callback. */
19421
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7547 static gboolean
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7548 add_message_history_to_gtkconv(gpointer data)
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7549 {
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7550 PidginConversation *gtkconv = data;
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7551 int count = 0;
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7552 int timer = gtkconv->attach.timer;
20051
d9a6d6ac2537 We can do this without forcing a minor bump.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20050
diff changeset
7553 time_t when = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(gtkconv->entry), "attach-start-time"));
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7554 gboolean im = (gtkconv->active_conv->type == PURPLE_CONV_TYPE_IM);
20051
d9a6d6ac2537 We can do this without forcing a minor bump.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20050
diff changeset
7555
19421
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7556 gtkconv->attach.timer = 0;
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7557 while (gtkconv->attach.current && count < 100) { /* XXX: 100 is a random value here */
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7558 PurpleConvMessage *msg = gtkconv->attach.current->data;
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7559 if (!im && when && when < msg->when) {
20051
d9a6d6ac2537 We can do this without forcing a minor bump.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20050
diff changeset
7560 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR><HR>", 0);
d9a6d6ac2537 We can do this without forcing a minor bump.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20050
diff changeset
7561 g_object_set_data(G_OBJECT(gtkconv->entry), "attach-start-time", NULL);
19902
c45e06d1901c Add a "<hr>" after the message history after redisplaying a hidden
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19901
diff changeset
7562 }
21263
1812b8ccfd7a Show alias in restored conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21244
diff changeset
7563 pidgin_conv_write_conv(msg->conv, msg->who, msg->alias, msg->what, msg->flags, msg->when);
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7564 if (im) {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7565 gtkconv->attach.current = g_list_delete_link(gtkconv->attach.current, gtkconv->attach.current);
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7566 } else {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7567 gtkconv->attach.current = gtkconv->attach.current->prev;
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7568 }
19421
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7569 count++;
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7570 }
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7571 gtkconv->attach.timer = timer;
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7572 if (gtkconv->attach.current)
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7573 return TRUE;
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7574
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7575 g_source_remove(gtkconv->attach.timer);
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7576 gtkconv->attach.timer = 0;
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7577 if (im) {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7578 /* Print any message that was sent while the old history was being added back. */
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7579 GList *msgs = NULL;
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7580 GList *iter = gtkconv->convs;
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7581 for (; iter; iter = iter->next) {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7582 PurpleConversation *conv = iter->data;
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7583 GList *history = purple_conversation_get_message_history(conv);
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7584 for (; history; history = history->next) {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7585 PurpleConvMessage *msg = history->data;
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7586 if (msg->when > when)
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7587 msgs = g_list_prepend(msgs, msg);
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7588 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7589 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7590 msgs = g_list_sort(msgs, message_compare);
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7591 for (; msgs; msgs = g_list_delete_link(msgs, msgs)) {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7592 PurpleConvMessage *msg = msgs->data;
21263
1812b8ccfd7a Show alias in restored conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21244
diff changeset
7593 pidgin_conv_write_conv(msg->conv, msg->who, msg->alias, msg->what, msg->flags, msg->when);
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7594 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7595 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR><HR>", 0);
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7596 g_object_set_data(G_OBJECT(gtkconv->entry), "attach-start-time", NULL);
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7597 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7598
20552
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7599 g_object_set_data(G_OBJECT(gtkconv->entry), "attach-start-time", NULL);
19556
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7600 purple_signal_emit(pidgin_conversations_get_handle(),
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7601 "conversation-displayed", gtkconv);
19421
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7602 return FALSE;
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7603 }
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7604
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7605 static void
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7606 pidgin_conv_attach(PurpleConversation *conv)
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7607 {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7608 int timer;
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7609 purple_conversation_set_data(conv, "unseen-count", NULL);
21284
6de09629f091 propagate from branch 'im.pidgin.pidgin.next.minor' (head 0c9637482b845cc65e95a26e144697391c51133f)
Ka-Hing Cheung <khc@hxbc.us>
parents: 21263 21050
diff changeset
7610 purple_conversation_set_data(conv, "unseen-state", NULL);
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7611 purple_conversation_set_ui_ops(conv, pidgin_conversations_get_conv_ui_ops());
21821
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
7612 if (!PIDGIN_CONVERSATION(conv))
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
7613 private_gtkconv_new(conv, FALSE);
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7614 timer = GPOINTER_TO_INT(purple_conversation_get_data(conv, "close-timer"));
21821
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
7615 if (timer) {
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7616 purple_timeout_remove(timer);
21821
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
7617 purple_conversation_set_data(conv, "close-timer", NULL);
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
7618 }
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7619 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7620
19417
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7621 gboolean pidgin_conv_attach_to_conversation(PurpleConversation *conv)
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7622 {
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7623 GList *list;
19421
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7624 PidginConversation *gtkconv;
19417
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7625
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7626 if (PIDGIN_IS_PIDGIN_CONVERSATION(conv)) {
21821
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
7627 /* This is pretty much always the case now. */
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7628 gtkconv = PIDGIN_CONVERSATION(conv);
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7629 if (gtkconv->win != hidden_convwin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7630 return FALSE;
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7631 pidgin_conv_window_remove_gtkconv(hidden_convwin, gtkconv);
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7632 pidgin_conv_placement_place(gtkconv);
21772
21371ea85970 Fix boldifying the chat entries in the buddylist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21766
diff changeset
7633 purple_signal_emit(pidgin_conversations_get_handle(),
21371ea85970 Fix boldifying the chat entries in the buddylist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21766
diff changeset
7634 "conversation-displayed", gtkconv);
21821
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
7635 list = gtkconv->convs;
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
7636 while (list) {
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
7637 pidgin_conv_attach(list->data);
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
7638 list = list->next;
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
7639 }
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7640 return TRUE;
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7641 }
19417
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7642
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7643 pidgin_conv_attach(conv);
19421
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7644 gtkconv = PIDGIN_CONVERSATION(conv);
19417
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7645
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7646 list = purple_conversation_get_message_history(conv);
19421
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7647 if (list) {
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7648 switch (purple_conversation_get_type(conv)) {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7649 case PURPLE_CONV_TYPE_IM:
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7650 {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7651 GList *convs;
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7652 list = g_list_copy(list);
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7653 for (convs = purple_get_ims(); convs; convs = convs->next)
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7654 if (convs->data != conv &&
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7655 pidgin_conv_find_gtkconv(convs->data) == gtkconv) {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7656 pidgin_conv_attach(convs->data);
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7657 list = g_list_concat(list, g_list_copy(purple_conversation_get_message_history(convs->data)));
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7658 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7659 list = g_list_sort(list, message_compare);
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7660 gtkconv->attach.current = list;
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7661 list = g_list_last(list);
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7662 break;
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7663 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7664 case PURPLE_CONV_TYPE_CHAT:
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7665 gtkconv->attach.current = g_list_last(list);
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7666 break;
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7667 default:
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7668 g_return_val_if_reached(TRUE);
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7669 }
20051
d9a6d6ac2537 We can do this without forcing a minor bump.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20050
diff changeset
7670 g_object_set_data(G_OBJECT(gtkconv->entry), "attach-start-time",
d9a6d6ac2537 We can do this without forcing a minor bump.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20050
diff changeset
7671 GINT_TO_POINTER(((PurpleConvMessage*)(list->data))->when));
19421
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7672 gtkconv->attach.timer = g_idle_add(add_message_history_to_gtkconv, gtkconv);
19556
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7673 } else {
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7674 purple_signal_emit(pidgin_conversations_get_handle(),
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7675 "conversation-displayed", gtkconv);
19417
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7676 }
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7677
19559
11849a5c3951 Update the chat topic and userlist when reattaching the Pidgin UI.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19556
diff changeset
7678 if (conv->type == PURPLE_CONV_TYPE_CHAT) {
11849a5c3951 Update the chat topic and userlist when reattaching the Pidgin UI.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19556
diff changeset
7679 pidgin_conv_update_fields(conv, PIDGIN_CONV_TOPIC);
11849a5c3951 Update the chat topic and userlist when reattaching the Pidgin UI.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19556
diff changeset
7680 pidgin_conv_chat_add_users(conv, PURPLE_CONV_CHAT(conv)->in_room, TRUE);
11849a5c3951 Update the chat topic and userlist when reattaching the Pidgin UI.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19556
diff changeset
7681 }
19417
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7682
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7683 return TRUE;
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7684 }
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7685
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7686 void *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7687 pidgin_conversations_get_handle(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7688 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7689 static int handle;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7690
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7691 return &handle;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7692 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7693
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7694 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7695 pidgin_conversations_init(void)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7696 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7697 void *handle = pidgin_conversations_get_handle();
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7698 void *blist_handle = purple_blist_get_handle();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7699
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7700 /* Conversations */
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7701 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/conversations");
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7702 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/use_smooth_scrolling", TRUE);
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7703 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/close_on_tabs", TRUE);
25508
e0add2aafeaf - merge nosuke's tab width patch.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 25504
diff changeset
7704 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/trim_vertical_tabs", FALSE);
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7705 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_bold", FALSE);
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7706 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_italic", FALSE);
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7707 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_underline", FALSE);
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7708 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/spellcheck", TRUE);
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7709 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/show_incoming_formatting", TRUE);
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7710
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7711 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/show_timestamps", TRUE);
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7712 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar", TRUE);
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7713
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7714 purple_prefs_add_string(PIDGIN_PREFS_ROOT "/conversations/placement", "last");
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7715 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/placement_number", 1);
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7716 purple_prefs_add_string(PIDGIN_PREFS_ROOT "/conversations/bgcolor", "");
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7717 purple_prefs_add_string(PIDGIN_PREFS_ROOT "/conversations/fgcolor", "");
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7718 purple_prefs_add_string(PIDGIN_PREFS_ROOT "/conversations/font_face", "");
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7719 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/font_size", 3);
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7720 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/tabs", TRUE);
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7721 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/tab_side", GTK_POS_TOP);
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7722 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/scrollback_lines", 4000);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7723
17489
747e5fd970e6 Reluctantly, I've added a preference for overriding the GTK+ default theme in GtkIMHtml widgets. There is support for this feature in the GNOME HIG and in other GTK+ (including GNOME) applications. This fixes #494. This is a GTK+ 2.4-only feature. I don't update the fonts in existing gtkimhtml's yet, only in new ones. Someone else may want to take care of that
Sean Egan <seanegan@gmail.com>
parents: 17423
diff changeset
7724 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/use_theme_font", TRUE);
17491
8e8da9a1eaac Fix default custom font
Sean Egan <seanegan@gmail.com>
parents: 17489
diff changeset
7725 purple_prefs_add_string(PIDGIN_PREFS_ROOT "/conversations/custom_font", "");
17489
747e5fd970e6 Reluctantly, I've added a preference for overriding the GTK+ default theme in GtkIMHtml widgets. There is support for this feature in the GNOME HIG and in other GTK+ (including GNOME) applications. This fixes #494. This is a GTK+ 2.4-only feature. I don't update the fonts in existing gtkimhtml's yet, only in new ones. Someone else may want to take care of that
Sean Egan <seanegan@gmail.com>
parents: 17423
diff changeset
7726
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7727 /* Conversations -> Chat */
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7728 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/conversations/chat");
19229
f1fb41d31c70 Set a larger default conversation size. Previously we were using
Mark Doliner <mark@kingant.net>
parents: 19223
diff changeset
7729 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/chat/entry_height", 54);
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7730 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/chat/userlist_width", 80);
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
7731 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/chat/x", 0);
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
7732 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/chat/y", 0);
19229
f1fb41d31c70 Set a larger default conversation size. Previously we were using
Mark Doliner <mark@kingant.net>
parents: 19223
diff changeset
7733 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/chat/width", 340);
f1fb41d31c70 Set a larger default conversation size. Previously we were using
Mark Doliner <mark@kingant.net>
parents: 19223
diff changeset
7734 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/chat/height", 390);
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
7735
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7736 /* Conversations -> IM */
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7737 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/conversations/im");
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
7738 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/im/x", 0);
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
7739 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/im/y", 0);
19229
f1fb41d31c70 Set a larger default conversation size. Previously we were using
Mark Doliner <mark@kingant.net>
parents: 19223
diff changeset
7740 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/im/width", 340);
f1fb41d31c70 Set a larger default conversation size. Previously we were using
Mark Doliner <mark@kingant.net>
parents: 19223
diff changeset
7741 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/im/height", 390);
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7742
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7743 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/im/animate_buddy_icons", TRUE);
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7744
19229
f1fb41d31c70 Set a larger default conversation size. Previously we were using
Mark Doliner <mark@kingant.net>
parents: 19223
diff changeset
7745 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/im/entry_height", 54);
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7746 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/im/show_buddy_icons", TRUE);
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7747
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7748 purple_prefs_add_string(PIDGIN_PREFS_ROOT "/conversations/im/hide_new", "never");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7749
18779
f6656fd1d2d5 Initialize the win32 minimize new conv. windows pref to avoid warnings.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18760
diff changeset
7750 #ifdef _WIN32
f6656fd1d2d5 Initialize the win32 minimize new conv. windows pref to avoid warnings.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18760
diff changeset
7751 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/win32/minimize_new_convs", FALSE);
f6656fd1d2d5 Initialize the win32 minimize new conv. windows pref to avoid warnings.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18760
diff changeset
7752 #endif
f6656fd1d2d5 Initialize the win32 minimize new conv. windows pref to avoid warnings.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18760
diff changeset
7753
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7754 /* Connect callbacks. */
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7755 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/close_on_tabs",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7756 close_on_tabs_pref_cb, NULL);
25508
e0add2aafeaf - merge nosuke's tab width patch.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 25504
diff changeset
7757 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/trim_vertical_tabs",
e0add2aafeaf - merge nosuke's tab width patch.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 25504
diff changeset
7758 trim_vertical_tabs_pref_cb, NULL);
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7759 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/show_timestamps",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7760 show_timestamps_pref_cb, NULL);
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7761 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7762 show_formatting_toolbar_pref_cb, NULL);
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7763 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/spellcheck",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7764 spellcheck_pref_cb, NULL);
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7765 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/tab_side",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7766 tab_side_pref_cb, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7767
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7768 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/tabs",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7769 conv_placement_usetabs_cb, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7770
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7771 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/placement",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7772 conv_placement_pref_cb, NULL);
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7773 purple_prefs_trigger_callback(PIDGIN_PREFS_ROOT "/conversations/placement");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7774
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7775 /* IM callbacks */
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7776 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/im/animate_buddy_icons",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7777 animate_buddy_icons_pref_cb, NULL);
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7778 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/im/show_buddy_icons",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7779 show_buddy_icons_pref_cb, NULL);
19474
74befdcd0454 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@gmail.com>
parents: 19468
diff changeset
7780 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/im/show_protocol_icons",
74befdcd0454 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@gmail.com>
parents: 19468
diff changeset
7781 show_protocol_icons_pref_cb, NULL);
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7782 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/im/hide_new",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7783 hide_new_pref_cb, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7784
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7785
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7786
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7787 /**********************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7788 * Register signals
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7789 **********************************************************************/
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7790 purple_signal_register(handle, "conversation-dragging",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7791 purple_marshal_VOID__POINTER_POINTER, NULL, 2,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7792 purple_value_new(PURPLE_TYPE_BOXED,
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7793 "PidginWindow *"),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7794 purple_value_new(PURPLE_TYPE_BOXED,
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7795 "PidginWindow *"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7796
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7797 purple_signal_register(handle, "conversation-timestamp",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7798 #if SIZEOF_TIME_T == 4
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7799 purple_marshal_POINTER__POINTER_INT_BOOLEAN,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7800 #elif SIZEOF_TIME_T == 8
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7801 purple_marshal_POINTER__POINTER_INT64_BOOLEAN,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7802 #else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7803 #error Unkown size of time_t
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7804 #endif
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7805 purple_value_new(PURPLE_TYPE_STRING), 3,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7806 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7807 PURPLE_SUBTYPE_CONVERSATION),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7808 #if SIZEOF_TIME_T == 4
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7809 purple_value_new(PURPLE_TYPE_INT),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7810 #elif SIZEOF_TIME_T == 8
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7811 purple_value_new(PURPLE_TYPE_INT64),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7812 #else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7813 # error Unknown size of time_t
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7814 #endif
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7815 purple_value_new(PURPLE_TYPE_BOOLEAN));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7816
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7817 purple_signal_register(handle, "displaying-im-msg",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7818 purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7819 purple_value_new(PURPLE_TYPE_BOOLEAN), 5,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7820 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7821 PURPLE_SUBTYPE_ACCOUNT),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7822 purple_value_new(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7823 purple_value_new_outgoing(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7824 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7825 PURPLE_SUBTYPE_CONVERSATION),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7826 purple_value_new(PURPLE_TYPE_INT));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7827
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7828 purple_signal_register(handle, "displayed-im-msg",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7829 purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7830 NULL, 5,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7831 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7832 PURPLE_SUBTYPE_ACCOUNT),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7833 purple_value_new(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7834 purple_value_new(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7835 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7836 PURPLE_SUBTYPE_CONVERSATION),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7837 purple_value_new(PURPLE_TYPE_INT));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7838
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7839 purple_signal_register(handle, "displaying-chat-msg",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7840 purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7841 purple_value_new(PURPLE_TYPE_BOOLEAN), 5,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7842 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7843 PURPLE_SUBTYPE_ACCOUNT),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7844 purple_value_new(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7845 purple_value_new_outgoing(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7846 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7847 PURPLE_SUBTYPE_CONVERSATION),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7848 purple_value_new(PURPLE_TYPE_INT));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7849
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7850 purple_signal_register(handle, "displayed-chat-msg",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7851 purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7852 NULL, 5,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7853 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7854 PURPLE_SUBTYPE_ACCOUNT),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7855 purple_value_new(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7856 purple_value_new(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7857 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7858 PURPLE_SUBTYPE_CONVERSATION),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7859 purple_value_new(PURPLE_TYPE_INT));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7860
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7861 purple_signal_register(handle, "conversation-switched",
21772
21371ea85970 Fix boldifying the chat entries in the buddylist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21766
diff changeset
7862 purple_marshal_VOID__POINTER, NULL, 1,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7863 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7864 PURPLE_SUBTYPE_CONVERSATION));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7865
19556
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7866 purple_signal_register(handle, "conversation-hiding",
21772
21371ea85970 Fix boldifying the chat entries in the buddylist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21766
diff changeset
7867 purple_marshal_VOID__POINTER, NULL, 1,
19556
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7868 purple_value_new(PURPLE_TYPE_BOXED,
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7869 "PidginConversation *"));
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7870
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7871 purple_signal_register(handle, "conversation-displayed",
21772
21371ea85970 Fix boldifying the chat entries in the buddylist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21766
diff changeset
7872 purple_marshal_VOID__POINTER, NULL, 1,
19556
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7873 purple_value_new(PURPLE_TYPE_BOXED,
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7874 "PidginConversation *"));
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7875
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7876 /**********************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7877 * Register commands
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7878 **********************************************************************/
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7879 purple_cmd_register("say", "S", PURPLE_CMD_P_DEFAULT,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7880 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7881 say_command_cb, _("say &lt;message&gt;: Send a message normally as if you weren't using a command."), NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7882 purple_cmd_register("me", "S", PURPLE_CMD_P_DEFAULT,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7883 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7884 me_command_cb, _("me &lt;action&gt;: Send an IRC style action to a buddy or chat."), NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7885 purple_cmd_register("debug", "w", PURPLE_CMD_P_DEFAULT,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7886 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7887 debug_command_cb, _("debug &lt;option&gt;: Send various debug information to the current conversation."), NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7888 purple_cmd_register("clear", "", PURPLE_CMD_P_DEFAULT,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7889 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7890 clear_command_cb, _("clear: Clears the conversation scrollback."), NULL);
18296
65cd831b39cd Patch from jeff to add a 'clearall' command to clear all the scrollbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18263
diff changeset
7891 purple_cmd_register("clearall", "", PURPLE_CMD_P_DEFAULT,
65cd831b39cd Patch from jeff to add a 'clearall' command to clear all the scrollbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18263
diff changeset
7892 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL,
65cd831b39cd Patch from jeff to add a 'clearall' command to clear all the scrollbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18263
diff changeset
7893 clearall_command_cb, _("clear: Clears all conversation scrollbacks."), NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7894 purple_cmd_register("help", "w", PURPLE_CMD_P_DEFAULT,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7895 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7896 help_command_cb, _("help &lt;command&gt;: Help on a specific command."), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7897
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7898 /**********************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7899 * UI operations
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7900 **********************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7901
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7902 purple_signal_connect(purple_connections_get_handle(), "signed-on", handle,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7903 G_CALLBACK(account_signed_off_cb),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7904 GINT_TO_POINTER(PURPLE_CONV_ACCOUNT_ONLINE));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7905 purple_signal_connect(purple_connections_get_handle(), "signed-off", handle,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7906 G_CALLBACK(account_signed_off_cb),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7907 GINT_TO_POINTER(PURPLE_CONV_ACCOUNT_OFFLINE));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7908
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7909 purple_signal_connect(purple_conversations_get_handle(), "received-im-msg",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7910 handle, G_CALLBACK(received_im_msg_cb), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7911
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7912 purple_conversations_set_ui_ops(&conversation_ui_ops);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7913
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7914 hidden_convwin = pidgin_conv_window_new();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7915 window_list = g_list_remove(window_list, hidden_convwin);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7916
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7917 purple_signal_connect(purple_accounts_get_handle(), "account-status-changed",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7918 handle, PURPLE_CALLBACK(account_status_changed_cb), NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7919
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7920 /* Callbacks to update a conversation */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7921 purple_signal_connect(blist_handle, "buddy-added", handle,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7922 G_CALLBACK(buddy_update_cb), NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7923 purple_signal_connect(blist_handle, "buddy-removed", handle,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7924 G_CALLBACK(buddy_update_cb), NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7925 purple_signal_connect(blist_handle, "buddy-signed-on",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7926 handle, PURPLE_CALLBACK(update_buddy_sign), "on");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7927 purple_signal_connect(blist_handle, "buddy-signed-off",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7928 handle, PURPLE_CALLBACK(update_buddy_sign), "off");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7929 purple_signal_connect(blist_handle, "buddy-status-changed",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7930 handle, PURPLE_CALLBACK(update_buddy_status_changed), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7931 purple_signal_connect(blist_handle, "buddy-privacy-changed",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7932 handle, PURPLE_CALLBACK(update_buddy_privacy_changed), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7933 purple_signal_connect(blist_handle, "buddy-idle-changed",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7934 handle, PURPLE_CALLBACK(update_buddy_idle_changed), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7935 purple_signal_connect(blist_handle, "buddy-icon-changed",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7936 handle, PURPLE_CALLBACK(update_buddy_icon), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7937 purple_signal_connect(purple_conversations_get_handle(), "buddy-typing",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7938 handle, PURPLE_CALLBACK(update_buddy_typing), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7939 purple_signal_connect(purple_conversations_get_handle(), "buddy-typing-stopped",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7940 handle, PURPLE_CALLBACK(update_buddy_typing), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7941 purple_signal_connect(pidgin_conversations_get_handle(), "conversation-switched",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7942 handle, PURPLE_CALLBACK(update_conversation_switched), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7943 purple_signal_connect(purple_conversations_get_handle(), "chat-left", handle,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7944 PURPLE_CALLBACK(update_chat), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7945 purple_signal_connect(purple_conversations_get_handle(), "chat-joined", handle,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7946 PURPLE_CALLBACK(update_chat), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7947 purple_signal_connect(purple_conversations_get_handle(), "chat-topic-changed", handle,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7948 PURPLE_CALLBACK(update_chat_topic), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7949 purple_signal_connect_priority(purple_conversations_get_handle(), "conversation-updated", handle,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7950 PURPLE_CALLBACK(pidgin_conv_updated), NULL,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7951 PURPLE_SIGNAL_PRIORITY_LOWEST);
19900
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
7952 purple_signal_connect(purple_conversations_get_handle(), "wrote-im-msg", handle,
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
7953 PURPLE_CALLBACK(wrote_msg_update_unseen_cb), NULL);
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
7954 purple_signal_connect(purple_conversations_get_handle(), "wrote-chat-msg", handle,
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
7955 PURPLE_CALLBACK(wrote_msg_update_unseen_cb), NULL);
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7956
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7957 {
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7958 /* Set default tab colors */
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7959 GString *str = g_string_new(NULL);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7960 GtkSettings *settings = gtk_settings_get_default();
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7961 struct {
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7962 const char *stylename;
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7963 const char *labelname;
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7964 const char *color;
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7965 } styles[] = {
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7966 {"pidgin_tab_label_typing_default", "tab-label-typing", "#4e9a06"},
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7967 {"pidgin_tab_label_typed_default", "tab-label-typed", "#c4a000"},
21749
866e139a79ef Feeling brave... a bright blue attention color for tab attention. I even
Stu Tomlinson <stu@nosnilmot.com>
parents: 21748
diff changeset
7968 {"pidgin_tab_label_attention_default", "tab-label-attention", "#006aff"},
21704
a4b36b22ea94 New style.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21703
diff changeset
7969 {"pidgin_tab_label_unreadchat_default", "tab-label-unreadchat", "#cc0000"},
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7970 {"pidgin_tab_label_event_default", "tab-label-event", "#888a85"},
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7971 {NULL, NULL, NULL}
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7972 };
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7973 int iter;
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7974 for (iter = 0; styles[iter].stylename; iter++) {
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7975 if (!gtk_rc_get_style_by_paths(settings, styles[iter].labelname, NULL, G_TYPE_NONE))
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7976 /* Apparently both ACTIVE and NORMAL are required */
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7977 g_string_append_printf(str, "style \"%s\" {\n"
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7978 "fg[ACTIVE] = \"%s\"\n"
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7979 "}\n"
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7980 "widget \"*%s\" style \"%s\"\n",
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7981 styles[iter].stylename,
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7982 styles[iter].color,
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7983 styles[iter].labelname, styles[iter].stylename);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7984 }
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7985 gtk_rc_parse_string(str->str);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7986 g_string_free(str, TRUE);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7987 #if GTK_CHECK_VERSION(2,4,0)
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7988 gtk_rc_reset_styles(settings);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7989 #endif
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7990 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7991 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7992
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7993 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7994 pidgin_conversations_uninit(void)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7995 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7996 purple_prefs_disconnect_by_handle(pidgin_conversations_get_handle());
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7997 purple_signals_disconnect_by_handle(pidgin_conversations_get_handle());
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7998 purple_signals_unregister_by_instance(pidgin_conversations_get_handle());
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7999 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8000
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8001
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8002
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8003
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8004
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8005
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8006
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8007
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8008
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8009
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8010
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8011
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8012
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8013
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8014
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8015
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8016 /* down here is where gtkconvwin.c ought to start. except they share like every freaking function,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8017 * and touch each others' private members all day long */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8018
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8019 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8020 * @file gtkconvwin.c GTK+ Conversation Window API
16193
247e421c4fa6 Rename the Doxygen group from gtkui to pidgin.
Richard Laager <rlaager@wiktel.com>
parents: 16084
diff changeset
8021 * @ingroup pidgin
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8022 *
15871
66dff3dfdea6 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
8023 * pidgin
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8024 *
15871
66dff3dfdea6 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
8025 * Pidgin is the legal property of its developers, whose names are too numerous
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8026 * to list here. Please refer to the COPYRIGHT file distributed with this
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8027 * source distribution.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8028 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8029 * This program is free software; you can redistribute it and/or modify
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8030 * it under the terms of the GNU General Public License as published by
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8031 * the Free Software Foundation; either version 2 of the License, or
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8032 * (at your option) any later version.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8033 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8034 * This program is distributed in the hope that it will be useful,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8035 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8036 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8037 * GNU General Public License for more details.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8038 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8039 * You should have received a copy of the GNU General Public License
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8040 * along with this program; if not, write to the Free Software
19680
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19668
diff changeset
8041 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8042 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8043 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8044 #include "internal.h"
15514
535f002e7b0f More pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15509
diff changeset
8045 #include "pidgin.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8046
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8047
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8048 #include <gdk/gdkkeysyms.h>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8049
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8050 #include "account.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8051 #include "cmds.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8052 #include "debug.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8053 #include "imgstore.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8054 #include "log.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8055 #include "notify.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8056 #include "prpl.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8057 #include "request.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8058 #include "util.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8059
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8060 #include "gtkdnd-hints.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8061 #include "gtkblist.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8062 #include "gtkconv.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8063 #include "gtkdialogs.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8064 #include "gtkmenutray.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8065 #include "gtkpounce.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8066 #include "gtkprefs.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8067 #include "gtkprivacy.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8068 #include "gtkutils.h"
15822
84b0f9b23ede According to etags, pidgin/ should be completely clean of references to 'gaim' as a client
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
8069 #include "pidginstock.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8070 #include "gtkimhtml.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8071 #include "gtkimhtmltoolbar.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8072
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8073 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8074 do_close(GtkWidget *w, int resp, PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8075 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8076 gtk_widget_destroy(warn_close_dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8077 warn_close_dialog = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8078
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8079 if (resp == GTK_RESPONSE_OK)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8080 pidgin_conv_window_destroy(win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8081 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8082
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8083 static void
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8084 build_warn_close_dialog(PidginWindow *gtkwin)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8085 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8086 GtkWidget *label;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8087 GtkWidget *vbox, *hbox;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8088 GtkWidget *img;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8089
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8090 g_return_if_fail(warn_close_dialog == NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8091
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8092
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8093 warn_close_dialog = gtk_dialog_new_with_buttons(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8094 _("Confirm close"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8095 GTK_WINDOW(gtkwin->window), GTK_DIALOG_MODAL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8096 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
18797
0622a7f08dde smaller close buttons on tabs. I think this looks really good.
Sean Egan <seanegan@gmail.com>
parents: 18796
diff changeset
8097 GTK_STOCK_CLOSE, GTK_RESPONSE_OK, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8098
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8099 gtk_dialog_set_default_response(GTK_DIALOG(warn_close_dialog),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8100 GTK_RESPONSE_OK);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8101
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8102 gtk_container_set_border_width(GTK_CONTAINER(warn_close_dialog),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8103 6);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8104 gtk_window_set_resizable(GTK_WINDOW(warn_close_dialog), FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8105 gtk_dialog_set_has_separator(GTK_DIALOG(warn_close_dialog),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8106 FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8107
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8108 /* Setup the outside spacing. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8109 vbox = GTK_DIALOG(warn_close_dialog)->vbox;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8110
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8111 gtk_box_set_spacing(GTK_BOX(vbox), 12);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8112 gtk_container_set_border_width(GTK_CONTAINER(vbox), 6);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8113
15436
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15435
diff changeset
8114 img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_WARNING,
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15435
diff changeset
8115 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_HUGE));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8116 /* Setup the inner hbox and put the dialog's icon in it. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8117 hbox = gtk_hbox_new(FALSE, 12);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8118 gtk_container_add(GTK_CONTAINER(vbox), hbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8119 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8120 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8121
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8122 /* Setup the right vbox. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8123 vbox = gtk_vbox_new(FALSE, 12);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8124 gtk_container_add(GTK_CONTAINER(hbox), vbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8125
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8126 label = gtk_label_new(_("You have unread messages. Are you sure you want to close the window?"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8127 gtk_widget_set_size_request(label, 350, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8128 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8129 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8130 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8131
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8132 /* Connect the signals. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8133 g_signal_connect(G_OBJECT(warn_close_dialog), "response",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8134 G_CALLBACK(do_close), gtkwin);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8135
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8136 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8137
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8138 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8139 * Callbacks
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8140 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8141
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8142 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8143 close_win_cb(GtkWidget *w, GdkEventAny *e, gpointer d)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8144 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8145 PidginWindow *win = d;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8146 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8147
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8148 /* If there are unread messages then show a warning dialog */
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8149 for (l = pidgin_conv_window_get_gtkconvs(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8150 l != NULL; l = l->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8151 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8152 PidginConversation *gtkconv = l->data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8153 if (purple_conversation_get_type(gtkconv->active_conv) == PURPLE_CONV_TYPE_IM &&
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
8154 gtkconv->unseen_state >= PIDGIN_UNSEEN_TEXT)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8155 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8156 build_warn_close_dialog(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8157 gtk_widget_show_all(warn_close_dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8158
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8159 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8160 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8161 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8162
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8163 pidgin_conv_window_destroy(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8164
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8165 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8166 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8167
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8168 static void
20953
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8169 conv_set_unseen(PurpleConversation *conv, PidginUnseenState state)
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8170 {
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8171 int unseen_count = 0;
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8172 PidginUnseenState unseen_state = PIDGIN_UNSEEN_NONE;
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8173
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8174 if(purple_conversation_get_data(conv, "unseen-count"))
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8175 unseen_count = GPOINTER_TO_INT(purple_conversation_get_data(conv, "unseen-count"));
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8176
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8177 if(purple_conversation_get_data(conv, "unseen-state"))
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8178 unseen_state = GPOINTER_TO_INT(purple_conversation_get_data(conv, "unseen-state"));
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8179
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8180 if (state == PIDGIN_UNSEEN_NONE)
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8181 {
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8182 unseen_count = 0;
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8183 unseen_state = PIDGIN_UNSEEN_NONE;
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8184 }
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8185 else
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8186 {
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8187 if (state >= PIDGIN_UNSEEN_TEXT)
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8188 unseen_count++;
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8189
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8190 if (state > unseen_state)
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8191 unseen_state = state;
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8192 }
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8193
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8194 purple_conversation_set_data(conv, "unseen-count", GINT_TO_POINTER(unseen_count));
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8195 purple_conversation_set_data(conv, "unseen-state", GINT_TO_POINTER(unseen_state));
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8196
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8197 purple_conversation_update(conv, PURPLE_CONV_UPDATE_UNSEEN);
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8198 }
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8199
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8200 static void
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
8201 gtkconv_set_unseen(PidginConversation *gtkconv, PidginUnseenState state)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8202 {
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
8203 if (state == PIDGIN_UNSEEN_NONE)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8204 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8205 gtkconv->unseen_count = 0;
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
8206 gtkconv->unseen_state = PIDGIN_UNSEEN_NONE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8207 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8208 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8209 {
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
8210 if (state >= PIDGIN_UNSEEN_TEXT)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8211 gtkconv->unseen_count++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8212
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8213 if (state > gtkconv->unseen_state)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8214 gtkconv->unseen_state = state;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8215 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8216
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8217 purple_conversation_update(gtkconv->active_conv, PURPLE_CONV_UPDATE_UNSEEN);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8218 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8219
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8220 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8221 * When a conversation window is focused, we know the user
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8222 * has looked at it so we know there are no longer unseen
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8223 * messages.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8224 */
19280
36189f0a8ae2 Make sure that there is an active conversation before trying to set the unseen state. It may be possible to trigger this when closing a window, but I think it is more likely to happen when using the Hide Conversation plugin or something like that. I think this fixes #2275.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19236
diff changeset
8225 static gboolean
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8226 focus_win_cb(GtkWidget *w, GdkEventFocus *e, gpointer d)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8227 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8228 PidginWindow *win = d;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8229 PidginConversation *gtkconv = pidgin_conv_window_get_active_gtkconv(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8230
19280
36189f0a8ae2 Make sure that there is an active conversation before trying to set the unseen state. It may be possible to trigger this when closing a window, but I think it is more likely to happen when using the Hide Conversation plugin or something like that. I think this fixes #2275.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19236
diff changeset
8231 if (gtkconv)
36189f0a8ae2 Make sure that there is an active conversation before trying to set the unseen state. It may be possible to trigger this when closing a window, but I think it is more likely to happen when using the Hide Conversation plugin or something like that. I think this fixes #2275.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19236
diff changeset
8232 gtkconv_set_unseen(gtkconv, PIDGIN_UNSEEN_NONE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8233
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8234 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8235 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8236
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8237 #if !GTK_CHECK_VERSION(2,6,0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8238 /* Courtesy of Galeon! */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8239 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8240 tab_close_button_state_changed_cb(GtkWidget *widget, GtkStateType prev_state)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8241 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8242 if (GTK_WIDGET_STATE(widget) == GTK_STATE_ACTIVE)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8243 gtk_widget_set_state(widget, GTK_STATE_NORMAL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8244 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8245 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8246
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8247 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8248 notebook_init_grab(PidginWindow *gtkwin, GtkWidget *widget)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8249 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8250 static GdkCursor *cursor = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8251
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8252 gtkwin->in_drag = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8253
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8254 if (gtkwin->drag_leave_signal) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8255 g_signal_handler_disconnect(G_OBJECT(widget),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8256 gtkwin->drag_leave_signal);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8257 gtkwin->drag_leave_signal = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8258 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8259
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8260 if (cursor == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8261 cursor = gdk_cursor_new(GDK_FLEUR);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8262
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8263 /* Grab the pointer */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8264 gtk_grab_add(gtkwin->notebook);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8265 #ifndef _WIN32
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8266 /* Currently for win32 GTK+ (as of 2.2.1), gdk_pointer_is_grabbed will
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8267 always be true after a button press. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8268 if (!gdk_pointer_is_grabbed())
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8269 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8270 gdk_pointer_grab(gtkwin->notebook->window, FALSE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8271 GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8272 NULL, cursor, GDK_CURRENT_TIME);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8273 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8274
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8275 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8276 notebook_motion_cb(GtkWidget *widget, GdkEventButton *e, PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8277 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8278
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8279 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8280 * Make sure the user moved the mouse far enough for the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8281 * drag to be initiated.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8282 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8283 if (win->in_predrag) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8284 if (e->x_root < win->drag_min_x ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8285 e->x_root >= win->drag_max_x ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8286 e->y_root < win->drag_min_y ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8287 e->y_root >= win->drag_max_y) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8288
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8289 win->in_predrag = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8290 notebook_init_grab(win, widget);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8291 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8292 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8293 else { /* Otherwise, draw the arrows. */
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8294 PidginWindow *dest_win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8295 GtkNotebook *dest_notebook;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8296 GtkWidget *tab;
17112
bee4ea11e299 Fix the tab-dragging arrows in conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17111
diff changeset
8297 gint page_num;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8298 gboolean horiz_tabs = FALSE;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8299 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8300 gboolean to_right = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8301
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8302 /* Get the window that the cursor is over. */
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8303 dest_win = pidgin_conv_window_get_at_xy(e->x_root, e->y_root);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8304
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8305 if (dest_win == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8306 dnd_hints_hide_all();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8307
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8308 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8309 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8310
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8311 dest_notebook = GTK_NOTEBOOK(dest_win->notebook);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8312
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8313 page_num = pidgin_conv_get_tab_at_xy(dest_win,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8314 e->x_root, e->y_root, &to_right);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8315 to_right = to_right && (win != dest_win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8316
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8317 if (gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_TOP ||
17112
bee4ea11e299 Fix the tab-dragging arrows in conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17111
diff changeset
8318 gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_BOTTOM) {
bee4ea11e299 Fix the tab-dragging arrows in conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17111
diff changeset
8319 horiz_tabs = TRUE;
bee4ea11e299 Fix the tab-dragging arrows in conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17111
diff changeset
8320 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8321
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8322 gtkconv = pidgin_conv_window_get_gtkconv_at_index(dest_win, page_num);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8323 tab = gtkconv->tabby;
19235
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8324 if (gtk_notebook_get_show_tabs(dest_notebook) == FALSE) {
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8325 dnd_hints_show_relative(HINT_ARROW_DOWN, gtkconv->infopane, HINT_POSITION_CENTER, HINT_POSITION_TOP);
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8326 dnd_hints_show_relative(HINT_ARROW_UP, gtkconv->infopane, HINT_POSITION_CENTER, HINT_POSITION_BOTTOM);
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8327 } else if (horiz_tabs) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8328 if (((gpointer)win == (gpointer)dest_win && win->drag_tab < page_num) || to_right) {
17112
bee4ea11e299 Fix the tab-dragging arrows in conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17111
diff changeset
8329 dnd_hints_show_relative(HINT_ARROW_DOWN, tab, HINT_POSITION_RIGHT, HINT_POSITION_TOP);
bee4ea11e299 Fix the tab-dragging arrows in conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17111
diff changeset
8330 dnd_hints_show_relative(HINT_ARROW_UP, tab, HINT_POSITION_RIGHT, HINT_POSITION_BOTTOM);
bee4ea11e299 Fix the tab-dragging arrows in conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17111
diff changeset
8331 } else {
bee4ea11e299 Fix the tab-dragging arrows in conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17111
diff changeset
8332 dnd_hints_show_relative(HINT_ARROW_DOWN, tab, HINT_POSITION_LEFT, HINT_POSITION_TOP);
bee4ea11e299 Fix the tab-dragging arrows in conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17111
diff changeset
8333 dnd_hints_show_relative(HINT_ARROW_UP, tab, HINT_POSITION_LEFT, HINT_POSITION_BOTTOM);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8334 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8335 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8336 if (((gpointer)win == (gpointer)dest_win && win->drag_tab < page_num) || to_right) {
17112
bee4ea11e299 Fix the tab-dragging arrows in conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17111
diff changeset
8337 dnd_hints_show_relative(HINT_ARROW_RIGHT, tab, HINT_POSITION_LEFT, HINT_POSITION_BOTTOM);
bee4ea11e299 Fix the tab-dragging arrows in conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17111
diff changeset
8338 dnd_hints_show_relative(HINT_ARROW_LEFT, tab, HINT_POSITION_RIGHT, HINT_POSITION_BOTTOM);
bee4ea11e299 Fix the tab-dragging arrows in conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17111
diff changeset
8339 } else {
bee4ea11e299 Fix the tab-dragging arrows in conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17111
diff changeset
8340 dnd_hints_show_relative(HINT_ARROW_RIGHT, tab, HINT_POSITION_LEFT, HINT_POSITION_TOP);
bee4ea11e299 Fix the tab-dragging arrows in conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17111
diff changeset
8341 dnd_hints_show_relative(HINT_ARROW_LEFT, tab, HINT_POSITION_RIGHT, HINT_POSITION_TOP);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8342 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8343 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8344 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8345
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8346 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8347 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8348
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8349 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8350 notebook_leave_cb(GtkWidget *widget, GdkEventCrossing *e, PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8351 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8352 if (win->in_drag)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8353 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8354
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8355 if (e->x_root < win->drag_min_x ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8356 e->x_root >= win->drag_max_x ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8357 e->y_root < win->drag_min_y ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8358 e->y_root >= win->drag_max_y) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8359
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8360 win->in_predrag = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8361 notebook_init_grab(win, widget);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8362 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8363
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8364 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8365 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8366
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8367 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8368 * THANK YOU GALEON!
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8369 */
18227
cbc89a49e43b Treat infopanes just like tabs for purposes of drag-and-drop. Then, don't show a tab for windows with only one tab, as the infopane serves the purpose better
Sean Egan <seanegan@gmail.com>
parents: 18218
diff changeset
8370
cbc89a49e43b Treat infopanes just like tabs for purposes of drag-and-drop. Then, don't show a tab for windows with only one tab, as the infopane serves the purpose better
Sean Egan <seanegan@gmail.com>
parents: 18218
diff changeset
8371 static gboolean
cbc89a49e43b Treat infopanes just like tabs for purposes of drag-and-drop. Then, don't show a tab for windows with only one tab, as the infopane serves the purpose better
Sean Egan <seanegan@gmail.com>
parents: 18218
diff changeset
8372 infopane_press_cb(GtkWidget *widget, GdkEventButton *e, PidginConversation *gtkconv)
cbc89a49e43b Treat infopanes just like tabs for purposes of drag-and-drop. Then, don't show a tab for windows with only one tab, as the infopane serves the purpose better
Sean Egan <seanegan@gmail.com>
parents: 18218
diff changeset
8373 {
19234
aafa9b36344e Double-click infopane to alias or change topic. Also, show alias instead of screenname in infopane
Sean Egan <seanegan@gmail.com>
parents: 19231
diff changeset
8374 if (e->type == GDK_2BUTTON_PRESS && e->button == 1) {
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8375 if (infopane_entry_activate(gtkconv))
19234
aafa9b36344e Double-click infopane to alias or change topic. Also, show alias instead of screenname in infopane
Sean Egan <seanegan@gmail.com>
parents: 19231
diff changeset
8376 return TRUE;
aafa9b36344e Double-click infopane to alias or change topic. Also, show alias instead of screenname in infopane
Sean Egan <seanegan@gmail.com>
parents: 19231
diff changeset
8377 }
aafa9b36344e Double-click infopane to alias or change topic. Also, show alias instead of screenname in infopane
Sean Egan <seanegan@gmail.com>
parents: 19231
diff changeset
8378
18523
0a8f9829640f Show the 'send to' menu on right click on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18465
diff changeset
8379 if (e->type != GDK_BUTTON_PRESS)
18227
cbc89a49e43b Treat infopanes just like tabs for purposes of drag-and-drop. Then, don't show a tab for windows with only one tab, as the infopane serves the purpose better
Sean Egan <seanegan@gmail.com>
parents: 18218
diff changeset
8380 return FALSE;
cbc89a49e43b Treat infopanes just like tabs for purposes of drag-and-drop. Then, don't show a tab for windows with only one tab, as the infopane serves the purpose better
Sean Egan <seanegan@gmail.com>
parents: 18218
diff changeset
8381
19235
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8382 if (e->button == 1) {
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8383 int nb_x, nb_y;
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8384
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8385 if (gtkconv->win->in_drag)
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8386 return TRUE;
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8387
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8388 gtkconv->win->in_predrag = TRUE;
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8389 gtkconv->win->drag_tab = gtk_notebook_page_num(GTK_NOTEBOOK(gtkconv->win->notebook), gtkconv->tab_cont);
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8390
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8391 gdk_window_get_origin(gtkconv->infopane_hbox->window, &nb_x, &nb_y);
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8392
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8393 gtkconv->win->drag_min_x = gtkconv->infopane_hbox->allocation.x + nb_x;
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8394 gtkconv->win->drag_min_y = gtkconv->infopane_hbox->allocation.y + nb_y;
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8395 gtkconv->win->drag_max_x = gtkconv->infopane_hbox->allocation.width + gtkconv->win->drag_min_x;
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8396 gtkconv->win->drag_max_y = gtkconv->infopane_hbox->allocation.height + gtkconv->win->drag_min_y;
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8397
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8398 gtkconv->win->drag_motion_signal = g_signal_connect(G_OBJECT(gtkconv->win->notebook), "motion_notify_event",
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8399 G_CALLBACK(notebook_motion_cb), gtkconv->win);
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8400 gtkconv->win->drag_leave_signal = g_signal_connect(G_OBJECT(gtkconv->win->notebook), "leave_notify_event",
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8401 G_CALLBACK(notebook_leave_cb), gtkconv->win);
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8402 return FALSE;
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8403 }
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8404
18523
0a8f9829640f Show the 'send to' menu on right click on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18465
diff changeset
8405 if (e->button == 3) {
0a8f9829640f Show the 'send to' menu on right click on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18465
diff changeset
8406 /* Right click was pressed. Popup the Send To menu. */
18658
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
8407 GtkWidget *menu = gtk_menu_new(), *sub;
19335
770b04e551a7 If you have the buddy notes plugin loaded, when you right click a chat's
Kevin Stange <kevin@simguy.net>
parents: 19312
diff changeset
8408 gboolean populated = populate_menu_with_options(menu, gtkconv, TRUE);
18658
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
8409 sub = gtk_menu_item_get_submenu(GTK_MENU_ITEM(gtkconv->win->menu.send_to));
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
8410
19335
770b04e551a7 If you have the buddy notes plugin loaded, when you right click a chat's
Kevin Stange <kevin@simguy.net>
parents: 19312
diff changeset
8411 if (sub && GTK_WIDGET_IS_SENSITIVE(gtkconv->win->menu.send_to)) {
20545
4a8407152e9a Change _Send To mnemonic to avoid conflicting with Smile
Sean Egan <seanegan@gmail.com>
parents: 20173
diff changeset
8412 GtkWidget *item = gtk_menu_item_new_with_mnemonic(_("S_end To"));
19335
770b04e551a7 If you have the buddy notes plugin loaded, when you right click a chat's
Kevin Stange <kevin@simguy.net>
parents: 19312
diff changeset
8413 if (populated)
770b04e551a7 If you have the buddy notes plugin loaded, when you right click a chat's
Kevin Stange <kevin@simguy.net>
parents: 19312
diff changeset
8414 pidgin_separator(menu);
18658
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
8415 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
8416 gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), sub);
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
8417 gtk_widget_show(item);
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
8418 gtk_widget_show_all(sub);
19335
770b04e551a7 If you have the buddy notes plugin loaded, when you right click a chat's
Kevin Stange <kevin@simguy.net>
parents: 19312
diff changeset
8419 } else if (!populated) {
770b04e551a7 If you have the buddy notes plugin loaded, when you right click a chat's
Kevin Stange <kevin@simguy.net>
parents: 19312
diff changeset
8420 gtk_widget_destroy(menu);
770b04e551a7 If you have the buddy notes plugin loaded, when you right click a chat's
Kevin Stange <kevin@simguy.net>
parents: 19312
diff changeset
8421 return FALSE;
18658
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
8422 }
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
8423
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
8424 gtk_widget_show_all(menu);
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
8425 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, e->button, e->time);
18523
0a8f9829640f Show the 'send to' menu on right click on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18465
diff changeset
8426 return TRUE;
18671
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
8427 }
18227
cbc89a49e43b Treat infopanes just like tabs for purposes of drag-and-drop. Then, don't show a tab for windows with only one tab, as the infopane serves the purpose better
Sean Egan <seanegan@gmail.com>
parents: 18218
diff changeset
8428 return FALSE;
18671
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
8429 }
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
8430
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8431 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8432 notebook_press_cb(GtkWidget *widget, GdkEventButton *e, PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8433 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8434 gint nb_x, nb_y, x_rel, y_rel;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8435 int tab_clicked;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8436 GtkWidget *page;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8437 GtkWidget *tab;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8438
15614
b6f9f5331a82 A double click on the conv. area was getting through to the middle-click parting code. What is worse is that it wasn't necessarily choosing the correct tab. I didn't want to change pidgin_conv_get_tab_at_xy() to only deal with being actually over a tab, so we will ignore double clicks here.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15602
diff changeset
8439 if (e->button == 2 && e->type == GDK_BUTTON_PRESS) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8440 PidginConversation *gtkconv;
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8441 tab_clicked = pidgin_conv_get_tab_at_xy(win, e->x_root, e->y_root, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8442
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8443 if (tab_clicked == -1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8444 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8445
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8446 gtkconv = pidgin_conv_window_get_gtkconv_at_index(win, tab_clicked);
18797
0622a7f08dde smaller close buttons on tabs. I think this looks really good.
Sean Egan <seanegan@gmail.com>
parents: 18796
diff changeset
8447 close_conv_cb(NULL, NULL, gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8448 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8449 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8450
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8451
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8452 if (e->button != 1 || e->type != GDK_BUTTON_PRESS)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8453 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8454
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8455
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8456 if (win->in_drag) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8457 purple_debug(PURPLE_DEBUG_WARNING, "gtkconv",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8458 "Already in the middle of a window drag at tab_press_cb\n");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8459 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8460 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8461
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8462 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8463 * Make sure a tab was actually clicked. The arrow buttons
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8464 * mess things up.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8465 */
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8466 tab_clicked = pidgin_conv_get_tab_at_xy(win, e->x_root, e->y_root, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8467
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8468 if (tab_clicked == -1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8469 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8470
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8471 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8472 * Get the relative position of the press event, with regards to
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8473 * the position of the notebook.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8474 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8475 gdk_window_get_origin(win->notebook->window, &nb_x, &nb_y);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8476
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8477 x_rel = e->x_root - nb_x;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8478 y_rel = e->y_root - nb_y;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8479
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8480 /* Reset the min/max x/y */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8481 win->drag_min_x = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8482 win->drag_min_y = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8483 win->drag_max_x = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8484 win->drag_max_y = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8485
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8486 /* Find out which tab was dragged. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8487 page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(win->notebook), tab_clicked);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8488 tab = gtk_notebook_get_tab_label(GTK_NOTEBOOK(win->notebook), page);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8489
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8490 win->drag_min_x = tab->allocation.x + nb_x;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8491 win->drag_min_y = tab->allocation.y + nb_y;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8492 win->drag_max_x = tab->allocation.width + win->drag_min_x;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8493 win->drag_max_y = tab->allocation.height + win->drag_min_y;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8494
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8495 /* Make sure the click occurred in the tab. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8496 if (e->x_root < win->drag_min_x ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8497 e->x_root >= win->drag_max_x ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8498 e->y_root < win->drag_min_y ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8499 e->y_root >= win->drag_max_y) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8500
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8501 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8502 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8503
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8504 win->in_predrag = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8505 win->drag_tab = tab_clicked;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8506
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8507 /* Connect the new motion signals. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8508 win->drag_motion_signal =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8509 g_signal_connect(G_OBJECT(widget), "motion_notify_event",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8510 G_CALLBACK(notebook_motion_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8511
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8512 win->drag_leave_signal =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8513 g_signal_connect(G_OBJECT(widget), "leave_notify_event",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8514 G_CALLBACK(notebook_leave_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8515
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8516 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8517 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8518
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8519 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8520 notebook_release_cb(GtkWidget *widget, GdkEventButton *e, PidginWindow *win)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8521 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8522 PidginWindow *dest_win;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8523 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8524 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8525 gint dest_page_num = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8526 gboolean new_window = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8527 gboolean to_right = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8528
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8529 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8530 * Don't check to make sure that the event's window matches the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8531 * widget's, because we may be getting an event passed on from the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8532 * close button.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8533 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8534 if (e->button != 1 && e->type != GDK_BUTTON_RELEASE)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8535 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8536
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8537 if (gdk_pointer_is_grabbed()) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8538 gdk_pointer_ungrab(GDK_CURRENT_TIME);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8539 gtk_grab_remove(widget);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8540 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8541
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8542 if (!win->in_predrag && !win->in_drag)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8543 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8544
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8545 /* Disconnect the motion signal. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8546 if (win->drag_motion_signal) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8547 g_signal_handler_disconnect(G_OBJECT(widget),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8548 win->drag_motion_signal);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8549
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8550 win->drag_motion_signal = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8551 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8552
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8553 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8554 * If we're in a pre-drag, we'll also need to disconnect the leave
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8555 * signal.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8556 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8557 if (win->in_predrag) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8558 win->in_predrag = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8559
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8560 if (win->drag_leave_signal) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8561 g_signal_handler_disconnect(G_OBJECT(widget),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8562 win->drag_leave_signal);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8563
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8564 win->drag_leave_signal = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8565 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8566 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8567
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8568 /* If we're not in drag... */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8569 /* We're perfectly normal people! */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8570 if (!win->in_drag)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8571 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8572
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8573 win->in_drag = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8574
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8575 dnd_hints_hide_all();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8576
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8577 dest_win = pidgin_conv_window_get_at_xy(e->x_root, e->y_root);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8578
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8579 conv = pidgin_conv_window_get_active_conversation(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8580
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8581 if (dest_win == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8582 /* If the current window doesn't have any other conversations,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8583 * there isn't much point transferring the conv to a new window. */
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8584 if (pidgin_conv_window_get_gtkconv_count(win) > 1) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8585 /* Make a new window to stick this to. */
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8586 dest_win = pidgin_conv_window_new();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8587 new_window = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8588 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8589 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8590
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8591 if (dest_win == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8592 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8593
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8594 purple_signal_emit(pidgin_conversations_get_handle(),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8595 "conversation-dragging", win, dest_win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8596
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8597 /* Get the destination page number. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8598 if (!new_window)
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8599 dest_page_num = pidgin_conv_get_tab_at_xy(dest_win,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8600 e->x_root, e->y_root, &to_right);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8601
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8602 gtkconv = pidgin_conv_window_get_gtkconv_at_index(win, win->drag_tab);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8603
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8604 if (win == dest_win) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8605 gtk_notebook_reorder_child(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont, dest_page_num);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8606 } else {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8607 pidgin_conv_window_remove_gtkconv(win, gtkconv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8608 pidgin_conv_window_add_gtkconv(dest_win, gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8609 gtk_notebook_reorder_child(GTK_NOTEBOOK(dest_win->notebook), gtkconv->tab_cont, dest_page_num + to_right);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8610 pidgin_conv_window_switch_gtkconv(dest_win, gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8611 if (new_window) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8612 gint win_width, win_height;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8613
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8614 gtk_window_get_size(GTK_WINDOW(dest_win->window),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8615 &win_width, &win_height);
19614
16776040e347 ifdef win32 the conversation placement code
Sean Egan <seanegan@gmail.com>
parents: 19600
diff changeset
8616 #ifdef WIN32 /* only override window manager placement on Windows */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8617 gtk_window_move(GTK_WINDOW(dest_win->window),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8618 e->x_root - (win_width / 2),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8619 e->y_root - (win_height / 2));
19614
16776040e347 ifdef win32 the conversation placement code
Sean Egan <seanegan@gmail.com>
parents: 19600
diff changeset
8620 #endif
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8621
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8622 pidgin_conv_window_show(dest_win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8623 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8624 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8625
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8626 gtk_widget_grab_focus(PIDGIN_CONVERSATION(conv)->entry);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8627
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8628 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8629 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8630
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8631
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8632 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8633 before_switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8634 gpointer user_data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8635 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8636 PidginWindow *win;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8637 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8638 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8639
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8640 win = user_data;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8641 conv = pidgin_conv_window_get_active_conversation(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8642
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8643 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8644
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8645 if (purple_conversation_get_type(conv) != PURPLE_CONV_TYPE_IM)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8646 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8647
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8648 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8649
17278
591d6c3e9f1f Stop the typing icon timer before switching conversations so the typing
Stu Tomlinson <stu@nosnilmot.com>
parents: 17257
diff changeset
8650 if (gtkconv->u.im->typing_timer != 0) {
591d6c3e9f1f Stop the typing icon timer before switching conversations so the typing
Stu Tomlinson <stu@nosnilmot.com>
parents: 17257
diff changeset
8651 g_source_remove(gtkconv->u.im->typing_timer);
591d6c3e9f1f Stop the typing icon timer before switching conversations so the typing
Stu Tomlinson <stu@nosnilmot.com>
parents: 17257
diff changeset
8652 gtkconv->u.im->typing_timer = 0;
591d6c3e9f1f Stop the typing icon timer before switching conversations so the typing
Stu Tomlinson <stu@nosnilmot.com>
parents: 17257
diff changeset
8653 }
591d6c3e9f1f Stop the typing icon timer before switching conversations so the typing
Stu Tomlinson <stu@nosnilmot.com>
parents: 17257
diff changeset
8654
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8655 stop_anim(NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8656 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8657 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8658 close_window(GtkWidget *w, PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8659 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8660 close_win_cb(w, NULL, win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8661 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8662
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8663 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8664 detach_tab_cb(GtkWidget *w, GObject *menu)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8665 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8666 PidginWindow *win, *new_window;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8667 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8668
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8669 gtkconv = g_object_get_data(menu, "clicked_tab");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8670
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8671 if (!gtkconv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8672 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8673
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8674 win = pidgin_conv_get_window(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8675 /* Nothing to do if there's only one tab in the window */
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8676 if (pidgin_conv_window_get_gtkconv_count(win) == 1)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8677 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8678
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8679 pidgin_conv_window_remove_gtkconv(win, gtkconv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8680
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8681 new_window = pidgin_conv_window_new();
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8682 pidgin_conv_window_add_gtkconv(new_window, gtkconv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8683 pidgin_conv_window_show(new_window);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8684 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8685
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8686 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8687 close_others_cb(GtkWidget *w, GObject *menu)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8688 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8689 GList *iter;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8690 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8691 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8692
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8693 gtkconv = g_object_get_data(menu, "clicked_tab");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8694
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8695 if (!gtkconv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8696 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8697
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8698 win = pidgin_conv_get_window(gtkconv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8699
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8700 for (iter = pidgin_conv_window_get_gtkconvs(win); iter; )
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8701 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8702 PidginConversation *gconv = iter->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8703 iter = iter->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8704
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8705 if (gconv != gtkconv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8706 {
18797
0622a7f08dde smaller close buttons on tabs. I think this looks really good.
Sean Egan <seanegan@gmail.com>
parents: 18796
diff changeset
8707 close_conv_cb(NULL, NULL, gconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8708 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8709 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8710 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8711
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8712 static void close_tab_cb(GtkWidget *w, GObject *menu)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8713 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8714 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8715
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8716 gtkconv = g_object_get_data(menu, "clicked_tab");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8717
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8718 if (gtkconv)
18797
0622a7f08dde smaller close buttons on tabs. I think this looks really good.
Sean Egan <seanegan@gmail.com>
parents: 18796
diff changeset
8719 close_conv_cb(NULL, NULL, gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8720 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8721
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8722 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8723 right_click_menu_cb(GtkNotebook *notebook, GdkEventButton *event, PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8724 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8725 GtkWidget *item, *menu;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8726 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8727
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8728 if (event->type != GDK_BUTTON_PRESS || event->button != 3)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8729 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8730
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8731 gtkconv = pidgin_conv_window_get_gtkconv_at_index(win,
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8732 pidgin_conv_get_tab_at_xy(win, event->x_root, event->y_root, NULL));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8733
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8734 if (g_object_get_data(G_OBJECT(notebook->menu), "clicked_tab"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8735 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8736 g_object_set_data(G_OBJECT(notebook->menu), "clicked_tab", gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8737 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8738 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8739
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8740 g_object_set_data(G_OBJECT(notebook->menu), "clicked_tab", gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8741
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8742 menu = notebook->menu;
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
8743 pidgin_separator(GTK_WIDGET(menu));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8744
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8745 item = gtk_menu_item_new_with_label(_("Close other tabs"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8746 gtk_widget_show(item);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8747 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8748 g_signal_connect(G_OBJECT(item), "activate",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8749 G_CALLBACK(close_others_cb), menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8750
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8751 item = gtk_menu_item_new_with_label(_("Close all tabs"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8752 gtk_widget_show(item);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8753 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8754 g_signal_connect(G_OBJECT(item), "activate",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8755 G_CALLBACK(close_window), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8756
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
8757 pidgin_separator(menu);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8758
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8759 item = gtk_menu_item_new_with_label(_("Detach this tab"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8760 gtk_widget_show(item);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8761 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8762 g_signal_connect(G_OBJECT(item), "activate",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8763 G_CALLBACK(detach_tab_cb), menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8764
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8765 item = gtk_menu_item_new_with_label(_("Close this tab"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8766 gtk_widget_show(item);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8767 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8768 g_signal_connect(G_OBJECT(item), "activate",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8769 G_CALLBACK(close_tab_cb), menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8770
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8771 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8772 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8773
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8774 static void
17106
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8775 remove_edit_entry(PidginConversation *gtkconv, GtkWidget *entry)
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8776 {
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8777 g_signal_handlers_disconnect_matched(G_OBJECT(entry), G_SIGNAL_MATCH_DATA,
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8778 0, 0, NULL, NULL, gtkconv);
19234
aafa9b36344e Double-click infopane to alias or change topic. Also, show alias instead of screenname in infopane
Sean Egan <seanegan@gmail.com>
parents: 19231
diff changeset
8779 gtk_widget_show(gtkconv->infopane);
17106
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8780 gtk_widget_grab_focus(gtkconv->entry);
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8781 gtk_widget_destroy(entry);
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8782 }
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8783
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8784 static gboolean
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8785 alias_focus_cb(GtkWidget *widget, GdkEventFocus *event, gpointer user_data)
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8786 {
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8787 remove_edit_entry(user_data, widget);
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8788 return FALSE;
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8789 }
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8790
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8791 static gboolean
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8792 alias_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8793 {
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8794 if (event->keyval == GDK_Escape) {
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8795 remove_edit_entry(user_data, widget);
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8796 return TRUE;
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8797 }
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8798 return FALSE;
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8799 }
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8800
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8801 static void
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8802 alias_cb(GtkEntry *entry, gpointer user_data)
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8803 {
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8804 PidginConversation *gtkconv;
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8805 PurpleConversation *conv;
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8806 PurpleAccount *account;
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8807 const char *name;
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8808
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8809 gtkconv = (PidginConversation *)user_data;
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8810 if (gtkconv == NULL) {
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8811 return;
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8812 }
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8813 conv = gtkconv->active_conv;
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8814 account = purple_conversation_get_account(conv);
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8815 name = purple_conversation_get_name(conv);
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8816
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8817 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) {
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8818 PurpleBuddy *buddy;
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8819 buddy = purple_find_buddy(account, name);
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8820 if (buddy != NULL) {
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8821 purple_blist_alias_buddy(buddy,
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8822 gtk_entry_get_text(entry));
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8823 }
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8824 serv_alias_buddy(buddy);
21731
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8825 } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) {
19234
aafa9b36344e Double-click infopane to alias or change topic. Also, show alias instead of screenname in infopane
Sean Egan <seanegan@gmail.com>
parents: 19231
diff changeset
8826 gtk_entry_set_text(GTK_ENTRY(gtkconv->u.chat->topic_text), gtk_entry_get_text(entry));
aafa9b36344e Double-click infopane to alias or change topic. Also, show alias instead of screenname in infopane
Sean Egan <seanegan@gmail.com>
parents: 19231
diff changeset
8827 topic_callback(NULL, gtkconv);
17106
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8828 }
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8829 remove_edit_entry(user_data, GTK_WIDGET(entry));
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8830 }
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8831
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8832 static gboolean
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8833 infopane_entry_activate(PidginConversation *gtkconv)
17106
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8834 {
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8835 GtkWidget *entry = NULL;
21731
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8836 PurpleConversation *conv = gtkconv->active_conv;
19234
aafa9b36344e Double-click infopane to alias or change topic. Also, show alias instead of screenname in infopane
Sean Egan <seanegan@gmail.com>
parents: 19231
diff changeset
8837 const char *text = NULL;
17106
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8838
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8839 if (!GTK_WIDGET_VISIBLE(gtkconv->tab_label)) {
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8840 /* There's already an entry for alias. Let's not create another one. */
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8841 return FALSE;
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8842 }
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8843
18238
7684084830c6 Fix a crash when trying to alias someone from the tab-label on a disconnected
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18227
diff changeset
8844 if (!purple_account_is_connected(gtkconv->active_conv->account)) {
18240
bc4518599c10 Sorry for my bed english lol
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18239
diff changeset
8845 /* Do not allow aliasing someone on a disconnected account. */
18238
7684084830c6 Fix a crash when trying to alias someone from the tab-label on a disconnected
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18227
diff changeset
8846 return FALSE;
7684084830c6 Fix a crash when trying to alias someone from the tab-label on a disconnected
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18227
diff changeset
8847 }
7684084830c6 Fix a crash when trying to alias someone from the tab-label on a disconnected
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18227
diff changeset
8848
19234
aafa9b36344e Double-click infopane to alias or change topic. Also, show alias instead of screenname in infopane
Sean Egan <seanegan@gmail.com>
parents: 19231
diff changeset
8849 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) {
aafa9b36344e Double-click infopane to alias or change topic. Also, show alias instead of screenname in infopane
Sean Egan <seanegan@gmail.com>
parents: 19231
diff changeset
8850 PurpleBuddy *buddy = purple_find_buddy(gtkconv->active_conv->account, gtkconv->active_conv->name);
aafa9b36344e Double-click infopane to alias or change topic. Also, show alias instead of screenname in infopane
Sean Egan <seanegan@gmail.com>
parents: 19231
diff changeset
8851 if (!buddy)
21731
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8852 /* This buddy isn't in your buddy list, so we can't alias him */
19234
aafa9b36344e Double-click infopane to alias or change topic. Also, show alias instead of screenname in infopane
Sean Egan <seanegan@gmail.com>
parents: 19231
diff changeset
8853 return FALSE;
21731
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8854
19234
aafa9b36344e Double-click infopane to alias or change topic. Also, show alias instead of screenname in infopane
Sean Egan <seanegan@gmail.com>
parents: 19231
diff changeset
8855 text = purple_buddy_get_contact_alias(buddy);
aafa9b36344e Double-click infopane to alias or change topic. Also, show alias instead of screenname in infopane
Sean Egan <seanegan@gmail.com>
parents: 19231
diff changeset
8856 } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) {
21731
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8857 PurpleConnection *gc;
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8858 PurplePluginProtocolInfo *prpl_info = NULL;
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8859
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8860 gc = purple_conversation_get_gc(conv);
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8861 if (gc != NULL)
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8862 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8863 if (prpl_info && prpl_info->set_chat_topic == NULL)
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8864 /* This protocol doesn't support setting the chat room topic */
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8865 return FALSE;
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8866
19234
aafa9b36344e Double-click infopane to alias or change topic. Also, show alias instead of screenname in infopane
Sean Egan <seanegan@gmail.com>
parents: 19231
diff changeset
8867 text = purple_conv_chat_get_topic(PURPLE_CONV_CHAT(conv));
aafa9b36344e Double-click infopane to alias or change topic. Also, show alias instead of screenname in infopane
Sean Egan <seanegan@gmail.com>
parents: 19231
diff changeset
8868 }
aafa9b36344e Double-click infopane to alias or change topic. Also, show alias instead of screenname in infopane
Sean Egan <seanegan@gmail.com>
parents: 19231
diff changeset
8869
17106
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8870 /* alias label */
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8871 entry = gtk_entry_new();
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8872 gtk_entry_set_has_frame(GTK_ENTRY(entry), FALSE);
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8873 gtk_entry_set_width_chars(GTK_ENTRY(entry), 10);
17423
ae30f9913bb4 Fix for gtk < 2.4
Stu Tomlinson <stu@nosnilmot.com>
parents: 17294
diff changeset
8874 #if GTK_CHECK_VERSION(2,4,0)
17106
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8875 gtk_entry_set_alignment(GTK_ENTRY(entry), 0.5);
17423
ae30f9913bb4 Fix for gtk < 2.4
Stu Tomlinson <stu@nosnilmot.com>
parents: 17294
diff changeset
8876 #endif
17106
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8877
19234
aafa9b36344e Double-click infopane to alias or change topic. Also, show alias instead of screenname in infopane
Sean Egan <seanegan@gmail.com>
parents: 19231
diff changeset
8878 gtk_box_pack_start(GTK_BOX(gtkconv->infopane_hbox), entry, TRUE, TRUE, 0);
17106
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8879 /* after the tab label */
19234
aafa9b36344e Double-click infopane to alias or change topic. Also, show alias instead of screenname in infopane
Sean Egan <seanegan@gmail.com>
parents: 19231
diff changeset
8880 gtk_box_reorder_child(GTK_BOX(gtkconv->infopane_hbox), entry, 0);
17106
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8881
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8882 g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(alias_cb), gtkconv);
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8883 g_signal_connect(G_OBJECT(entry), "focus-out-event", G_CALLBACK(alias_focus_cb), gtkconv);
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8884 g_signal_connect(G_OBJECT(entry), "key-press-event", G_CALLBACK(alias_key_press_cb), gtkconv);
21731
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8885
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8886 if (text != NULL)
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8887 gtk_entry_set_text(GTK_ENTRY(entry), text);
17106
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8888 gtk_widget_show(entry);
19234
aafa9b36344e Double-click infopane to alias or change topic. Also, show alias instead of screenname in infopane
Sean Egan <seanegan@gmail.com>
parents: 19231
diff changeset
8889 gtk_widget_hide(gtkconv->infopane);
17106
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8890 gtk_widget_grab_focus(entry);
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8891
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8892 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8893 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8894
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8895 static gboolean
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8896 window_keypress_cb(GtkWidget *widget, GdkEventKey *event, PidginWindow *win)
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8897 {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8898 PidginConversation *gtkconv = pidgin_conv_window_get_active_gtkconv(win);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8899
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8900 return conv_keypress_common(gtkconv, event);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8901 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8902
17106
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8903 static void
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8904 switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8905 gpointer user_data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8906 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8907 PidginWindow *win;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8908 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8909 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8910 const char *sound_method;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8911
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8912 win = user_data;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8913 gtkconv = pidgin_conv_window_get_gtkconv_at_index(win, page_num);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8914 conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8915
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8916 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8917
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8918 /* clear unseen flag if conversation is not hidden */
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8919 if(!pidgin_conv_is_hidden(gtkconv)) {
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
8920 gtkconv_set_unseen(gtkconv, PIDGIN_UNSEEN_NONE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8921 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8922
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8923 /* Update the menubar */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8924
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8925 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkconv->win->menu.logging),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8926 purple_conversation_is_logging(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8927
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8928 generate_send_to_items(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8929 regenerate_options_items(win);
17392
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
8930 regenerate_plugins_items(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8931
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8932 pidgin_conv_switch_active_conversation(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8933
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
8934 sound_method = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8935 if (strcmp(sound_method, "none") != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8936 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8937 gtkconv->make_sound);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8938
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8939 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.show_formatting_toolbar),
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
8940 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8941
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8942 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.show_timestamps),
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
8943 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_timestamps"));
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8944
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8945 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8946 * We pause icons when they are not visible. If this icon should
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8947 * be animated then start it back up again.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8948 */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8949 if ((purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) &&
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8950 (gtkconv->u.im->animate))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8951 start_anim(NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8952
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8953 purple_signal_emit(pidgin_conversations_get_handle(), "conversation-switched", conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8954 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8955
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8956 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8957 * GTK+ window ops
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8958 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8959
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8960 GList *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8961 pidgin_conv_windows_get_list()
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8962 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8963 return window_list;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8964 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8965
16315
ee4ce3c4186f Fix #248 (Control shouldn't steal focus from scrollback)
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16286
diff changeset
8966 static GList*
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8967 make_status_icon_list(const char *stock, GtkWidget *w)
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8968 {
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8969 GList *l = NULL;
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8970 l = g_list_append(l, gtk_widget_render_icon (w, stock,
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8971 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL), "GtkWindow"));
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8972 l = g_list_append(l, gtk_widget_render_icon (w, stock,
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8973 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_SMALL), "GtkWindow"));
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8974 l = g_list_append(l, gtk_widget_render_icon (w, stock,
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8975 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_MEDIUM), "GtkWindow"));
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8976 l = g_list_append(l, gtk_widget_render_icon (w, stock,
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8977 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_LARGE), "GtkWindow"));
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8978 return l;
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8979 }
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8980
16315
ee4ce3c4186f Fix #248 (Control shouldn't steal focus from scrollback)
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16286
diff changeset
8981 static void
ee4ce3c4186f Fix #248 (Control shouldn't steal focus from scrollback)
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16286
diff changeset
8982 create_icon_lists(GtkWidget *w)
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8983 {
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8984 available_list = make_status_icon_list(PIDGIN_STOCK_STATUS_AVAILABLE, w);
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8985 busy_list = make_status_icon_list(PIDGIN_STOCK_STATUS_BUSY, w);
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8986 xa_list = make_status_icon_list(PIDGIN_STOCK_STATUS_XA, w);
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8987 login_list = make_status_icon_list(PIDGIN_STOCK_STATUS_LOGIN, w);
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8988 logout_list = make_status_icon_list(PIDGIN_STOCK_STATUS_LOGOUT, w);
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8989 offline_list = make_status_icon_list(PIDGIN_STOCK_STATUS_OFFLINE, w);
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8990 away_list = make_status_icon_list(PIDGIN_STOCK_STATUS_AWAY, w);
15724
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
8991 prpl_lists = g_hash_table_new(g_str_hash, g_str_equal);
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8992 }
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8993
17392
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
8994 static void
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
8995 plugin_changed_cb(PurplePlugin *p, gpointer data)
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
8996 {
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
8997 regenerate_plugins_items(data);
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
8998 }
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
8999
18328
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9000 static gboolean gtk_conv_configure_cb(GtkWidget *w, GdkEventConfigure *event, gpointer data) {
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9001 int x, y;
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9002
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9003 if (GTK_WIDGET_VISIBLE(w))
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9004 gtk_window_get_position(GTK_WINDOW(w), &x, &y);
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9005 else
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9006 return FALSE; /* carry on normally */
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9007
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9008 /* Workaround for GTK+ bug # 169811 - "configure_event" is fired
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9009 * when the window is being maximized */
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9010 if (gdk_window_get_state(w->window) & GDK_WINDOW_STATE_MAXIMIZED)
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9011 return FALSE;
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9012
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9013 /* don't save off-screen positioning */
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9014 if (x + event->width < 0 ||
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9015 y + event->height < 0 ||
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9016 x > gdk_screen_width() ||
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9017 y > gdk_screen_height())
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9018 return FALSE; /* carry on normally */
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9019
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9020 /* store the position */
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9021 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/im/x", x);
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9022 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/im/y", y);
18328
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9023 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/im/width", event->width);
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9024 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/im/height", event->height);
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9025
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9026 /* continue to handle event normally */
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9027 return FALSE;
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9028
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9029 }
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9030
18625
672dd03f538a More work on the conversation sizing/positioning stuff. Still nothing IM or chat specific
Sean Egan <seanegan@gmail.com>
parents: 18621
diff changeset
9031 static void
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9032 pidgin_conv_set_position_size(PidginWindow *win, int conv_x, int conv_y,
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9033 int conv_width, int conv_height)
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9034 {
18625
672dd03f538a More work on the conversation sizing/positioning stuff. Still nothing IM or chat specific
Sean Egan <seanegan@gmail.com>
parents: 18621
diff changeset
9035 /* if the window exists, is hidden, we're saving positions, and the
672dd03f538a More work on the conversation sizing/positioning stuff. Still nothing IM or chat specific
Sean Egan <seanegan@gmail.com>
parents: 18621
diff changeset
9036 * position is sane... */
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9037 if (win && win->window &&
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9038 !GTK_WIDGET_VISIBLE(win->window) && conv_width != 0) {
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9039
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9040 /* ...check position is on screen... */
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9041 if (conv_x >= gdk_screen_width())
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9042 conv_x = gdk_screen_width() - 100;
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9043 else if (conv_x + conv_width < 0)
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9044 conv_x = 100;
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9045
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9046 if (conv_y >= gdk_screen_height())
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9047 conv_y = gdk_screen_height() - 100;
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9048 else if (conv_y + conv_height < 0)
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9049 conv_y = 100;
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9050
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9051 /* ...and move it back. */
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9052 gtk_window_move(GTK_WINDOW(win->window), conv_x, conv_y);
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9053 gtk_window_resize(GTK_WINDOW(win->window), conv_width, conv_height);
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9054 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9055 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9056
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9057 static void
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9058 pidgin_conv_restore_position(PidginWindow *win) {
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9059 pidgin_conv_set_position_size(win,
18791
f36fc45b7866 really make restoring size and position work
Ka-Hing Cheung <khc@hxbc.us>
parents: 18790
diff changeset
9060 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/im/x"),
f36fc45b7866 really make restoring size and position work
Ka-Hing Cheung <khc@hxbc.us>
parents: 18790
diff changeset
9061 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/im/y"),
f36fc45b7866 really make restoring size and position work
Ka-Hing Cheung <khc@hxbc.us>
parents: 18790
diff changeset
9062 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/im/width"),
f36fc45b7866 really make restoring size and position work
Ka-Hing Cheung <khc@hxbc.us>
parents: 18790
diff changeset
9063 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/im/height"));
18625
672dd03f538a More work on the conversation sizing/positioning stuff. Still nothing IM or chat specific
Sean Egan <seanegan@gmail.com>
parents: 18621
diff changeset
9064 }
672dd03f538a More work on the conversation sizing/positioning stuff. Still nothing IM or chat specific
Sean Egan <seanegan@gmail.com>
parents: 18621
diff changeset
9065
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9066 PidginWindow *
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9067 pidgin_conv_window_new()
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9068 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9069 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9070 GtkPositionType pos;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9071 GtkWidget *testidea;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9072 GtkWidget *menubar;
21006
f43d7aafe1f8 Use gtk_window_set_focus_on_map() to prevent focus on new conversation windows (hopefully only) when the new window was prompted by an external event. This seems to work pretty well, but I suppose those with higher expectations of their WM will be sure to tell me if this messes something up. References #3618.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21000
diff changeset
9073 #if GTK_CHECK_VERSION(2,6,0)
f43d7aafe1f8 Use gtk_window_set_focus_on_map() to prevent focus on new conversation windows (hopefully only) when the new window was prompted by an external event. This seems to work pretty well, but I suppose those with higher expectations of their WM will be sure to tell me if this messes something up. References #3618.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21000
diff changeset
9074 GdkModifierType state;
f43d7aafe1f8 Use gtk_window_set_focus_on_map() to prevent focus on new conversation windows (hopefully only) when the new window was prompted by an external event. This seems to work pretty well, but I suppose those with higher expectations of their WM will be sure to tell me if this messes something up. References #3618.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21000
diff changeset
9075 #endif
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9076
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9077 win = g_malloc0(sizeof(PidginWindow));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9078
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9079 window_list = g_list_append(window_list, win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9080
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9081 /* Create the window. */
17166
92c3c2eeba87 Added to gtkutils.c:
Gabriel Schulhof <nix@go-nix.ca>
parents: 17116
diff changeset
9082 win->window = pidgin_create_window(NULL, 0, "conversation", TRUE);
21006
f43d7aafe1f8 Use gtk_window_set_focus_on_map() to prevent focus on new conversation windows (hopefully only) when the new window was prompted by an external event. This seems to work pretty well, but I suppose those with higher expectations of their WM will be sure to tell me if this messes something up. References #3618.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21000
diff changeset
9083 #if GTK_CHECK_VERSION(2,6,0)
f43d7aafe1f8 Use gtk_window_set_focus_on_map() to prevent focus on new conversation windows (hopefully only) when the new window was prompted by an external event. This seems to work pretty well, but I suppose those with higher expectations of their WM will be sure to tell me if this messes something up. References #3618.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21000
diff changeset
9084 if (!gtk_get_current_event_state(&state))
f43d7aafe1f8 Use gtk_window_set_focus_on_map() to prevent focus on new conversation windows (hopefully only) when the new window was prompted by an external event. This seems to work pretty well, but I suppose those with higher expectations of their WM will be sure to tell me if this messes something up. References #3618.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21000
diff changeset
9085 gtk_window_set_focus_on_map(GTK_WINDOW(win->window), FALSE);
f43d7aafe1f8 Use gtk_window_set_focus_on_map() to prevent focus on new conversation windows (hopefully only) when the new window was prompted by an external event. This seems to work pretty well, but I suppose those with higher expectations of their WM will be sure to tell me if this messes something up. References #3618.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21000
diff changeset
9086 #endif
18625
672dd03f538a More work on the conversation sizing/positioning stuff. Still nothing IM or chat specific
Sean Egan <seanegan@gmail.com>
parents: 18621
diff changeset
9087 pidgin_conv_restore_position(win);
17260
baaf2cf9339c disapproval of revision '1f819f5ad330efa81ac7906f854b46f0c8bbd7b6'
Ethan Blanton <elb@pidgin.im>
parents: 17259
diff changeset
9088
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
9089 if (available_list == NULL) {
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
9090 create_icon_lists(win->window);
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
9091 }
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
9092
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9093 g_signal_connect(G_OBJECT(win->window), "delete_event",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9094 G_CALLBACK(close_win_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9095 g_signal_connect(G_OBJECT(win->window), "focus_in_event",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9096 G_CALLBACK(focus_win_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9097
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
9098 /* Intercept keystrokes from the menu items */
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
9099 g_signal_connect(G_OBJECT(win->window), "key_press_event",
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
9100 G_CALLBACK(window_keypress_cb), win);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
9101
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
9102
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9103 /* Create the notebook. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9104 win->notebook = gtk_notebook_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9105
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
9106 pos = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/tab_side");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9107
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9108 #if 0
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9109 gtk_notebook_set_tab_hborder(GTK_NOTEBOOK(win->notebook), 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9110 gtk_notebook_set_tab_vborder(GTK_NOTEBOOK(win->notebook), 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9111 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9112 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(win->notebook), pos);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9113 gtk_notebook_set_scrollable(GTK_NOTEBOOK(win->notebook), TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9114 gtk_notebook_popup_enable(GTK_NOTEBOOK(win->notebook));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9115 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), FALSE);
19312
6cec9e871ad2 Keep borders on conversation notebook even when tabs are not shown.
Sean Egan <seanegan@gmail.com>
parents: 19311
diff changeset
9116 gtk_notebook_set_show_border(GTK_NOTEBOOK(win->notebook), TRUE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9117
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9118 g_signal_connect(G_OBJECT(win->notebook), "button-press-event",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9119 G_CALLBACK(right_click_menu_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9120
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9121 gtk_widget_show(win->notebook);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9122
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9123 g_signal_connect(G_OBJECT(win->notebook), "switch_page",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9124 G_CALLBACK(before_switch_conv_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9125 g_signal_connect_after(G_OBJECT(win->notebook), "switch_page",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9126 G_CALLBACK(switch_conv_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9127
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9128 /* Setup the tab drag and drop signals. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9129 gtk_widget_add_events(win->notebook,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9130 GDK_BUTTON1_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9131 g_signal_connect(G_OBJECT(win->notebook), "button_press_event",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9132 G_CALLBACK(notebook_press_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9133 g_signal_connect(G_OBJECT(win->notebook), "button_release_event",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9134 G_CALLBACK(notebook_release_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9135
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9136 testidea = gtk_vbox_new(FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9137
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9138 /* Setup the menubar. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9139 menubar = setup_menubar(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9140 gtk_box_pack_start(GTK_BOX(testidea), menubar, FALSE, TRUE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9141
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9142 gtk_box_pack_start(GTK_BOX(testidea), win->notebook, TRUE, TRUE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9143
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9144 gtk_container_add(GTK_CONTAINER(win->window), testidea);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9145
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9146 gtk_widget_show(testidea);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9147
17392
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
9148 /* Update the plugin actions when plugins are (un)loaded */
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
9149 purple_signal_connect(purple_plugins_get_handle(), "plugin-load",
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
9150 win, PURPLE_CALLBACK(plugin_changed_cb), win);
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
9151 purple_signal_connect(purple_plugins_get_handle(), "plugin-unload",
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
9152 win, PURPLE_CALLBACK(plugin_changed_cb), win);
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
9153
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
9154
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9155 #ifdef _WIN32
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9156 g_signal_connect(G_OBJECT(win->window), "show",
15515
75ffc646647f Win32 de-gaimification of pidgin
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15509
diff changeset
9157 G_CALLBACK(winpidgin_ensure_onscreen), win->window);
18460
b91a29987d71 Give Windows users the option of having new conversation windows created minimized. Hopefully this will stop the incessant crying about this. Fixes #664.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18452
diff changeset
9158
21006
f43d7aafe1f8 Use gtk_window_set_focus_on_map() to prevent focus on new conversation windows (hopefully only) when the new window was prompted by an external event. This seems to work pretty well, but I suppose those with higher expectations of their WM will be sure to tell me if this messes something up. References #3618.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21000
diff changeset
9159 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/win32/minimize_new_convs")
f43d7aafe1f8 Use gtk_window_set_focus_on_map() to prevent focus on new conversation windows (hopefully only) when the new window was prompted by an external event. This seems to work pretty well, but I suppose those with higher expectations of their WM will be sure to tell me if this messes something up. References #3618.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21000
diff changeset
9160 && !gtk_get_current_event_state(&state))
18460
b91a29987d71 Give Windows users the option of having new conversation windows created minimized. Hopefully this will stop the incessant crying about this. Fixes #664.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18452
diff changeset
9161 gtk_window_iconify(GTK_WINDOW(win->window));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9162 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9163
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9164 return win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9165 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9166
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9167 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9168 pidgin_conv_window_destroy(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9169 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9170 purple_prefs_disconnect_by_handle(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9171 window_list = g_list_remove(window_list, win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9172
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9173 /* Close the "Find" dialog if it's open */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9174 if (win->dialogs.search)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9175 gtk_widget_destroy(win->dialogs.search);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9176
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9177 if (win->gtkconvs) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9178 while (win->gtkconvs) {
20077
fee0eea83e58 Honour the persistency when closing the window from the WM.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20051
diff changeset
9179 gboolean last = (win->gtkconvs->next == NULL);
fee0eea83e58 Honour the persistency when closing the window from the WM.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20051
diff changeset
9180 close_conv_cb(NULL, NULL, win->gtkconvs->data);
fee0eea83e58 Honour the persistency when closing the window from the WM.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20051
diff changeset
9181 if (last)
fee0eea83e58 Honour the persistency when closing the window from the WM.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20051
diff changeset
9182 break;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9183 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9184 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9185 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9186 gtk_widget_destroy(win->window);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9187
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9188 g_object_unref(G_OBJECT(win->menu.item_factory));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9189
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9190 purple_notify_close_with_handle(win);
17392
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
9191 purple_signals_disconnect_by_handle(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9192
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9193 g_free(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9194 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9195
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9196 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9197 pidgin_conv_window_show(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9198 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9199 gtk_widget_show(win->window);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9200 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9201
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9202 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9203 pidgin_conv_window_hide(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9204 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9205 gtk_widget_hide(win->window);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9206 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9207
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9208 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9209 pidgin_conv_window_raise(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9210 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9211 gdk_window_raise(GDK_WINDOW(win->window->window));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9212 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9213
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9214 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9215 pidgin_conv_window_switch_gtkconv(PidginWindow *win, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9216 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9217 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9218 gtk_notebook_page_num(GTK_NOTEBOOK(win->notebook),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9219 gtkconv->tab_cont));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9220 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9221
18864
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9222 static gboolean
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9223 close_button_left_cb(GtkWidget *widget, GdkEventCrossing *event, GtkLabel *label)
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9224 {
19232
4b8238290a94 Make the close-button underlined, instead of bold, and change the cursor to hand.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19231
diff changeset
9225 static GdkCursor *ptr = NULL;
4b8238290a94 Make the close-button underlined, instead of bold, and change the cursor to hand.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19231
diff changeset
9226 if (ptr == NULL) {
4b8238290a94 Make the close-button underlined, instead of bold, and change the cursor to hand.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19231
diff changeset
9227 ptr = gdk_cursor_new(GDK_LEFT_PTR);
4b8238290a94 Make the close-button underlined, instead of bold, and change the cursor to hand.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19231
diff changeset
9228 }
4b8238290a94 Make the close-button underlined, instead of bold, and change the cursor to hand.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19231
diff changeset
9229
27746
e13759a83714 propagate from branch 'im.pidgin.pidgin' (head cff05fbceab1d88163770d13a4c7a6116bdeb8ee)
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 27745 21823
diff changeset
9230 gtk_label_set_markup(label, "×");
19232
4b8238290a94 Make the close-button underlined, instead of bold, and change the cursor to hand.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19231
diff changeset
9231 gdk_window_set_cursor(event->window, ptr);
18864
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9232 return FALSE;
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9233 }
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9234
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9235 static gboolean
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9236 close_button_entered_cb(GtkWidget *widget, GdkEventCrossing *event, GtkLabel *label)
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9237 {
19232
4b8238290a94 Make the close-button underlined, instead of bold, and change the cursor to hand.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19231
diff changeset
9238 static GdkCursor *hand = NULL;
4b8238290a94 Make the close-button underlined, instead of bold, and change the cursor to hand.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19231
diff changeset
9239 if (hand == NULL) {
4b8238290a94 Make the close-button underlined, instead of bold, and change the cursor to hand.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19231
diff changeset
9240 hand = gdk_cursor_new(GDK_HAND2);
4b8238290a94 Make the close-button underlined, instead of bold, and change the cursor to hand.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19231
diff changeset
9241 }
4b8238290a94 Make the close-button underlined, instead of bold, and change the cursor to hand.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19231
diff changeset
9242
27746
e13759a83714 propagate from branch 'im.pidgin.pidgin' (head cff05fbceab1d88163770d13a4c7a6116bdeb8ee)
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 27745 21823
diff changeset
9243 gtk_label_set_markup(label, "<u>×</u>");
19232
4b8238290a94 Make the close-button underlined, instead of bold, and change the cursor to hand.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19231
diff changeset
9244 gdk_window_set_cursor(event->window, hand);
18864
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9245 return FALSE;
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9246 }
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9247
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9248 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9249 pidgin_conv_window_add_gtkconv(PidginWindow *win, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9250 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9251 PurpleConversation *conv = gtkconv->active_conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9252 PidginConversation *focus_gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9253 GtkWidget *tab_cont = gtkconv->tab_cont;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9254 GtkWidget *close_image;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9255 PurpleConversationType conv_type;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9256 const gchar *tmp_lab;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9257
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9258 conv_type = purple_conversation_get_type(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9259
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9260 win->gtkconvs = g_list_append(win->gtkconvs, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9261 gtkconv->win = win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9262
18603
5610c2ea0d94 revert 'no visible tabs when only one conversation' as it proved unpopular. Made tabs only fill the entire width of the notebook when there's only one tab to avoid http://pidgin.im/~deryni/that_just_looks_dumb.png
Sean Egan <seanegan@gmail.com>
parents: 18602
diff changeset
9263 if (win->gtkconvs && win->gtkconvs->next && win->gtkconvs->next->next == NULL)
5610c2ea0d94 revert 'no visible tabs when only one conversation' as it proved unpopular. Made tabs only fill the entire width of the notebook when there's only one tab to avoid http://pidgin.im/~deryni/that_just_looks_dumb.png
Sean Egan <seanegan@gmail.com>
parents: 18602
diff changeset
9264 pidgin_conv_tab_pack(win, ((PidginConversation*)win->gtkconvs->data));
5610c2ea0d94 revert 'no visible tabs when only one conversation' as it proved unpopular. Made tabs only fill the entire width of the notebook when there's only one tab to avoid http://pidgin.im/~deryni/that_just_looks_dumb.png
Sean Egan <seanegan@gmail.com>
parents: 18602
diff changeset
9265
5610c2ea0d94 revert 'no visible tabs when only one conversation' as it proved unpopular. Made tabs only fill the entire width of the notebook when there's only one tab to avoid http://pidgin.im/~deryni/that_just_looks_dumb.png
Sean Egan <seanegan@gmail.com>
parents: 18602
diff changeset
9266
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9267 /* Close button. */
18797
0622a7f08dde smaller close buttons on tabs. I think this looks really good.
Sean Egan <seanegan@gmail.com>
parents: 18796
diff changeset
9268 gtkconv->close = gtk_event_box_new();
20286
0ce367508ab6 Fix for compiling with Gtk < 2.4, references #3144
Stu Tomlinson <stu@nosnilmot.com>
parents: 20251
diff changeset
9269 #if GTK_CHECK_VERSION(2,4,0)
18821
0765cf9331f6 warning fixes
Sean Egan <seanegan@gmail.com>
parents: 18820
diff changeset
9270 gtk_event_box_set_visible_window(GTK_EVENT_BOX(gtkconv->close), FALSE);
20286
0ce367508ab6 Fix for compiling with Gtk < 2.4, references #3144
Stu Tomlinson <stu@nosnilmot.com>
parents: 20251
diff changeset
9271 #endif
18864
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9272 gtk_widget_set_events(gtkconv->close, GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK);
27746
e13759a83714 propagate from branch 'im.pidgin.pidgin' (head cff05fbceab1d88163770d13a4c7a6116bdeb8ee)
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 27745 21823
diff changeset
9273 close_image = gtk_label_new("×");
18864
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9274 g_signal_connect(G_OBJECT(gtkconv->close), "enter-notify-event", G_CALLBACK(close_button_entered_cb), close_image);
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9275 g_signal_connect(G_OBJECT(gtkconv->close), "leave-notify-event", G_CALLBACK(close_button_left_cb), close_image);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9276 gtk_widget_show(close_image);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9277 gtk_container_add(GTK_CONTAINER(gtkconv->close), close_image);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9278 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->close,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9279 _("Close conversation"), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9280
18797
0622a7f08dde smaller close buttons on tabs. I think this looks really good.
Sean Egan <seanegan@gmail.com>
parents: 18796
diff changeset
9281 g_signal_connect(G_OBJECT(gtkconv->close), "button-press-event",
18876
e4a4d7ab4bf0 The entries in the right-click menu on the tabs was getting cut off for me.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18864
diff changeset
9282 G_CALLBACK(close_conv_cb), gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9283
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9284 #if !GTK_CHECK_VERSION(2,6,0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9285 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9286 * I love Galeon. They have a fix for that stupid annoying visible
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9287 * border bug. I love you guys! -- ChipX86
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9288 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9289 /* This is fixed properly in some version of Gtk before 2.6.0 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9290 g_signal_connect(G_OBJECT(gtkconv->close), "state_changed",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9291 G_CALLBACK(tab_close_button_state_changed_cb), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9292 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9293
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9294 /* Status icon. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9295 gtkconv->icon = gtk_image_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9296 gtkconv->menu_icon = gtk_image_new();
19291
c003aa584909 Remove truncation until we can do it smarter
Sean Egan <seanegan@gmail.com>
parents: 19290
diff changeset
9297 gtk_widget_show(gtkconv->icon);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9298 update_tab_icon(conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9299
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9300 /* Tab label. */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9301 gtkconv->tab_label = gtk_label_new(tmp_lab = purple_conversation_get_title(conv));
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
9302 gtk_widget_set_name(gtkconv->tab_label, "tab-label");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9303
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9304 gtkconv->menu_tabby = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
18876
e4a4d7ab4bf0 The entries in the right-click menu on the tabs was getting cut off for me.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18864
diff changeset
9305 gtkconv->menu_label = gtk_label_new(tmp_lab);
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9306 gtk_box_pack_start(GTK_BOX(gtkconv->menu_tabby), gtkconv->menu_icon, FALSE, FALSE, 0);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9307
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9308 gtk_widget_show_all(gtkconv->menu_icon);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9309
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9310 gtk_box_pack_start(GTK_BOX(gtkconv->menu_tabby), gtkconv->menu_label, TRUE, TRUE, 0);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9311 gtk_widget_show(gtkconv->menu_label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9312 gtk_misc_set_alignment(GTK_MISC(gtkconv->menu_label), 0, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9313
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9314 gtk_widget_show(gtkconv->menu_tabby);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9315
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9316 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM)
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9317 pidgin_conv_update_buddy_icon(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9318
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9319 /* Build and set conversations tab */
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9320 pidgin_conv_tab_pack(win, gtkconv);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9321
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9322 gtk_notebook_set_menu_label(GTK_NOTEBOOK(win->notebook), tab_cont, gtkconv->menu_tabby);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9323
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9324 gtk_widget_show(tab_cont);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9325
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9326 if (pidgin_conv_window_get_gtkconv_count(win) == 1) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9327 /* Er, bug in notebooks? Switch to the page manually. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9328 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), 0);
18603
5610c2ea0d94 revert 'no visible tabs when only one conversation' as it proved unpopular. Made tabs only fill the entire width of the notebook when there's only one tab to avoid http://pidgin.im/~deryni/that_just_looks_dumb.png
Sean Egan <seanegan@gmail.com>
parents: 18602
diff changeset
9329 } else {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9330 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), TRUE);
18603
5610c2ea0d94 revert 'no visible tabs when only one conversation' as it proved unpopular. Made tabs only fill the entire width of the notebook when there's only one tab to avoid http://pidgin.im/~deryni/that_just_looks_dumb.png
Sean Egan <seanegan@gmail.com>
parents: 18602
diff changeset
9331 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9332
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9333 focus_gtkconv = g_list_nth_data(pidgin_conv_window_get_gtkconvs(win),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9334 gtk_notebook_get_current_page(GTK_NOTEBOOK(win->notebook)));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9335 gtk_widget_grab_focus(focus_gtkconv->entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9336
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9337 if (pidgin_conv_window_get_gtkconv_count(win) == 1)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9338 update_send_to_selection(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9339 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9340
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9341 static void
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9342 pidgin_conv_tab_pack(PidginWindow *win, PidginConversation *gtkconv)
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9343 {
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9344 gboolean tabs_side = FALSE;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9345 gint angle = 0;
17106
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
9346 GtkWidget *first, *third, *ebox;
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9347
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9348 if (purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/tab_side") == GTK_POS_LEFT ||
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9349 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/tab_side") == GTK_POS_RIGHT)
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9350 tabs_side = TRUE;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9351 else if (purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/tab_side") == (GTK_POS_LEFT|8))
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9352 angle = 90;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9353 else if (purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/tab_side") == (GTK_POS_RIGHT|8))
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9354 angle = 270;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9355
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9356 #if GTK_CHECK_VERSION(2,6,0)
19361
272d08484f7d remove obsolote GNOME color pallete
Sean Egan <seanegan@gmail.com>
parents: 19335
diff changeset
9357 if (!angle) {
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9358 g_object_set(G_OBJECT(gtkconv->tab_label), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
19291
c003aa584909 Remove truncation until we can do it smarter
Sean Egan <seanegan@gmail.com>
parents: 19290
diff changeset
9359 gtk_label_set_width_chars(GTK_LABEL(gtkconv->tab_label), 4);
18603
5610c2ea0d94 revert 'no visible tabs when only one conversation' as it proved unpopular. Made tabs only fill the entire width of the notebook when there's only one tab to avoid http://pidgin.im/~deryni/that_just_looks_dumb.png
Sean Egan <seanegan@gmail.com>
parents: 18602
diff changeset
9360 } else {
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9361 g_object_set(G_OBJECT(gtkconv->tab_label), "ellipsize", PANGO_ELLIPSIZE_NONE, NULL);
18603
5610c2ea0d94 revert 'no visible tabs when only one conversation' as it proved unpopular. Made tabs only fill the entire width of the notebook when there's only one tab to avoid http://pidgin.im/~deryni/that_just_looks_dumb.png
Sean Egan <seanegan@gmail.com>
parents: 18602
diff changeset
9362 gtk_label_set_width_chars(GTK_LABEL(gtkconv->tab_label), -1);
5610c2ea0d94 revert 'no visible tabs when only one conversation' as it proved unpopular. Made tabs only fill the entire width of the notebook when there's only one tab to avoid http://pidgin.im/~deryni/that_just_looks_dumb.png
Sean Egan <seanegan@gmail.com>
parents: 18602
diff changeset
9363 }
5610c2ea0d94 revert 'no visible tabs when only one conversation' as it proved unpopular. Made tabs only fill the entire width of the notebook when there's only one tab to avoid http://pidgin.im/~deryni/that_just_looks_dumb.png
Sean Egan <seanegan@gmail.com>
parents: 18602
diff changeset
9364
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9365 if (tabs_side) {
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9366 gtk_label_set_width_chars(
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9367 GTK_LABEL(gtkconv->tab_label),
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9368 MIN(g_utf8_strlen(gtk_label_get_text(GTK_LABEL(gtkconv->tab_label)), -1), 12)
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9369 );
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9370 }
18787
09103d3ba774 fix a bug when you set your tabs to side vertical and change back, the tab
Ka-Hing Cheung <khc@hxbc.us>
parents: 18781
diff changeset
9371
09103d3ba774 fix a bug when you set your tabs to side vertical and change back, the tab
Ka-Hing Cheung <khc@hxbc.us>
parents: 18781
diff changeset
9372 gtk_label_set_angle(GTK_LABEL(gtkconv->tab_label), angle);
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9373 #endif
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9374
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9375 #if 0
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9376 gtk_misc_set_alignment(GTK_MISC(gtkconv->tab_label), 0.00, 0.5);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9377 gtk_misc_set_padding(GTK_MISC(gtkconv->tab_label), 4, 0);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9378 #endif
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9379
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9380 if (angle)
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9381 gtkconv->tabby = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9382 else
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9383 gtkconv->tabby = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9384
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9385 /* select the correct ordering for verticle tabs */
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9386 if (angle == 90) {
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9387 first = gtkconv->close;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9388 third = gtkconv->icon;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9389 } else {
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9390 first = gtkconv->icon;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9391 third = gtkconv->close;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9392 }
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9393
17106
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
9394 ebox = gtk_event_box_new();
17423
ae30f9913bb4 Fix for gtk < 2.4
Stu Tomlinson <stu@nosnilmot.com>
parents: 17294
diff changeset
9395 #if GTK_CHECK_VERSION(2,4,0)
17116
80350acaa289 Fix background color issues in the coversation tabs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17112
diff changeset
9396 gtk_event_box_set_visible_window(GTK_EVENT_BOX(ebox), FALSE);
17423
ae30f9913bb4 Fix for gtk < 2.4
Stu Tomlinson <stu@nosnilmot.com>
parents: 17294
diff changeset
9397 #endif
17106
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
9398 gtk_container_add(GTK_CONTAINER(ebox), gtkconv->tabby);
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
9399
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9400 if (gtkconv->tab_label->parent == NULL) {
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9401 /* Pack if it's a new widget */
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9402 gtk_box_pack_start(GTK_BOX(gtkconv->tabby), first, FALSE, FALSE, 0);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9403 gtk_box_pack_start(GTK_BOX(gtkconv->tabby), gtkconv->tab_label, TRUE, TRUE, 0);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9404 gtk_box_pack_start(GTK_BOX(gtkconv->tabby), third, FALSE, FALSE, 0);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9405
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9406 /* Add this pane to the conversation's notebook. */
17106
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
9407 gtk_notebook_append_page(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont, ebox);
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9408 } else {
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9409 /* reparent old widgets on preference changes */
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9410 gtk_widget_reparent(first, gtkconv->tabby);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9411 gtk_widget_reparent(gtkconv->tab_label, gtkconv->tabby);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9412 gtk_widget_reparent(third, gtkconv->tabby);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9413 gtk_box_set_child_packing(GTK_BOX(gtkconv->tabby), first, FALSE, FALSE, 0, GTK_PACK_START);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9414 gtk_box_set_child_packing(GTK_BOX(gtkconv->tabby), gtkconv->tab_label, TRUE, TRUE, 0, GTK_PACK_START);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9415 gtk_box_set_child_packing(GTK_BOX(gtkconv->tabby), third, FALSE, FALSE, 0, GTK_PACK_START);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9416
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9417 /* Reset the tabs label to the new version */
17106
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
9418 gtk_notebook_set_tab_label(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont, ebox);
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9419 }
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9420
18603
5610c2ea0d94 revert 'no visible tabs when only one conversation' as it proved unpopular. Made tabs only fill the entire width of the notebook when there's only one tab to avoid http://pidgin.im/~deryni/that_just_looks_dumb.png
Sean Egan <seanegan@gmail.com>
parents: 18602
diff changeset
9421 gtk_notebook_set_tab_label_packing(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont,
19362
cbc08c427db6 Don't show tabs if tabs aren't turned on. Fixes #2669
Sean Egan <seanegan@gmail.com>
parents: 19361
diff changeset
9422 !tabs_side && !angle,
18603
5610c2ea0d94 revert 'no visible tabs when only one conversation' as it proved unpopular. Made tabs only fill the entire width of the notebook when there's only one tab to avoid http://pidgin.im/~deryni/that_just_looks_dumb.png
Sean Egan <seanegan@gmail.com>
parents: 18602
diff changeset
9423 TRUE, GTK_PACK_START);
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9424
18863
f85e3866bf93 Let's try this again. Tabs are not visible if there's only one conversation open
Sean Egan <seanegan@gmail.com>
parents: 18852
diff changeset
9425 if (pidgin_conv_window_get_gtkconv_count(win) == 1)
f85e3866bf93 Let's try this again. Tabs are not visible if there's only one conversation open
Sean Egan <seanegan@gmail.com>
parents: 18852
diff changeset
9426 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook),
19362
cbc08c427db6 Don't show tabs if tabs aren't turned on. Fixes #2669
Sean Egan <seanegan@gmail.com>
parents: 19361
diff changeset
9427 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/tabs") &&
19483
b66909a58e5f Only hide single tab on Top-tabbed windows
Sean Egan <seanegan@gmail.com>
parents: 19478
diff changeset
9428 (!purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/im/show_buddy_icons") ||
b66909a58e5f Only hide single tab on Top-tabbed windows
Sean Egan <seanegan@gmail.com>
parents: 19478
diff changeset
9429 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/tab_side") != GTK_POS_TOP));
18863
f85e3866bf93 Let's try this again. Tabs are not visible if there's only one conversation open
Sean Egan <seanegan@gmail.com>
parents: 18852
diff changeset
9430
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9431 /* show the widgets */
18782
450a3dae477a Experimental tab-space-saving experiments. use text formatting instead of icons to represent status. Truncate buddy's names at a space or at-sign to make tabs more readable.
Sean Egan <seanegan@gmail.com>
parents: 18781
diff changeset
9432 /* gtk_widget_show(gtkconv->icon); */
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9433 gtk_widget_show(gtkconv->tab_label);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9434 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/close_on_tabs"))
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9435 gtk_widget_show(gtkconv->close);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9436 gtk_widget_show(gtkconv->tabby);
17106
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
9437 gtk_widget_show(ebox);
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9438 }
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9439
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9440 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9441 pidgin_conv_window_remove_gtkconv(PidginWindow *win, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9442 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9443 unsigned int index;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9444 PurpleConversationType conv_type;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9445
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9446 conv_type = purple_conversation_get_type(gtkconv->active_conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9447 index = gtk_notebook_page_num(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9448
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9449 g_object_ref(gtkconv->tab_cont);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9450 gtk_object_sink(GTK_OBJECT(gtkconv->tab_cont));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9451
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9452 gtk_notebook_remove_page(GTK_NOTEBOOK(win->notebook), index);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9453
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9454 win->gtkconvs = g_list_remove(win->gtkconvs, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9455
19681
c35e8c057441 Fix a crash in window-placement.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19680
diff changeset
9456 g_signal_handlers_disconnect_matched(win->window, G_SIGNAL_MATCH_DATA,
c35e8c057441 Fix a crash in window-placement.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19680
diff changeset
9457 0, 0, NULL, NULL, gtkconv);
c35e8c057441 Fix a crash in window-placement.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19680
diff changeset
9458
18603
5610c2ea0d94 revert 'no visible tabs when only one conversation' as it proved unpopular. Made tabs only fill the entire width of the notebook when there's only one tab to avoid http://pidgin.im/~deryni/that_just_looks_dumb.png
Sean Egan <seanegan@gmail.com>
parents: 18602
diff changeset
9459 if (win->gtkconvs && win->gtkconvs->next == NULL)
5610c2ea0d94 revert 'no visible tabs when only one conversation' as it proved unpopular. Made tabs only fill the entire width of the notebook when there's only one tab to avoid http://pidgin.im/~deryni/that_just_looks_dumb.png
Sean Egan <seanegan@gmail.com>
parents: 18602
diff changeset
9460 pidgin_conv_tab_pack(win, win->gtkconvs->data);
18227
cbc89a49e43b Treat infopanes just like tabs for purposes of drag-and-drop. Then, don't show a tab for windows with only one tab, as the infopane serves the purpose better
Sean Egan <seanegan@gmail.com>
parents: 18218
diff changeset
9461
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9462 if (!win->gtkconvs && win != hidden_convwin)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9463 pidgin_conv_window_destroy(win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9464 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9465
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9466 PidginConversation *
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9467 pidgin_conv_window_get_gtkconv_at_index(const PidginWindow *win, int index)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9468 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9469 GtkWidget *tab_cont;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9470
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9471 if (index == -1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9472 index = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9473 tab_cont = gtk_notebook_get_nth_page(GTK_NOTEBOOK(win->notebook), index);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9474 return tab_cont ? g_object_get_data(G_OBJECT(tab_cont), "PidginConversation") : NULL;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9475 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9476
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9477 PidginConversation *
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9478 pidgin_conv_window_get_active_gtkconv(const PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9479 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9480 int index;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9481 GtkWidget *tab_cont;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9482
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9483 index = gtk_notebook_get_current_page(GTK_NOTEBOOK(win->notebook));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9484 if (index == -1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9485 index = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9486 tab_cont = gtk_notebook_get_nth_page(GTK_NOTEBOOK(win->notebook), index);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9487 if (!tab_cont)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9488 return NULL;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9489 return g_object_get_data(G_OBJECT(tab_cont), "PidginConversation");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9490 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9491
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9492
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9493 PurpleConversation *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9494 pidgin_conv_window_get_active_conversation(const PidginWindow *win)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9495 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9496 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9497
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9498 gtkconv = pidgin_conv_window_get_active_gtkconv(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9499 return gtkconv ? gtkconv->active_conv : NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9500 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9501
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9502 gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9503 pidgin_conv_window_is_active_conversation(const PurpleConversation *conv)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9504 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9505 return conv == pidgin_conv_window_get_active_conversation(PIDGIN_CONVERSATION(conv)->win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9506 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9507
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9508 gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9509 pidgin_conv_window_has_focus(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9510 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9511 gboolean has_focus = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9512
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9513 g_object_get(G_OBJECT(win->window), "has-toplevel-focus", &has_focus, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9514
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9515 return has_focus;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9516 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9517
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9518 PidginWindow *
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9519 pidgin_conv_window_get_at_xy(int x, int y)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9520 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9521 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9522 GdkWindow *gdkwin;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9523 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9524
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9525 gdkwin = gdk_window_at_pointer(&x, &y);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9526
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9527 if (gdkwin)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9528 gdkwin = gdk_window_get_toplevel(gdkwin);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9529
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9530 for (l = pidgin_conv_windows_get_list(); l != NULL; l = l->next) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9531 win = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9532
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9533 if (gdkwin == win->window->window)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9534 return win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9535 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9536
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9537 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9538 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9539
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9540 GList *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9541 pidgin_conv_window_get_gtkconvs(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9542 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9543 return win->gtkconvs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9544 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9545
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9546 guint
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9547 pidgin_conv_window_get_gtkconv_count(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9548 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9549 return g_list_length(win->gtkconvs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9550 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9551
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9552 PidginWindow *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9553 pidgin_conv_window_first_with_type(PurpleConversationType type)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9554 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9555 GList *wins, *convs;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9556 PidginWindow *win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9557 PidginConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9558
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9559 if (type == PURPLE_CONV_TYPE_UNKNOWN)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9560 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9561
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9562 for (wins = pidgin_conv_windows_get_list(); wins != NULL; wins = wins->next) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9563 win = wins->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9564
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9565 for (convs = win->gtkconvs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9566 convs != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9567 convs = convs->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9568
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9569 conv = convs->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9570
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9571 if (purple_conversation_get_type(conv->active_conv) == type)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9572 return win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9573 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9574 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9575
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9576 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9577 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9578
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9579 PidginWindow *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9580 pidgin_conv_window_last_with_type(PurpleConversationType type)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9581 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9582 GList *wins, *convs;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9583 PidginWindow *win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9584 PidginConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9585
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9586 if (type == PURPLE_CONV_TYPE_UNKNOWN)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9587 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9588
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9589 for (wins = g_list_last(pidgin_conv_windows_get_list());
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9590 wins != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9591 wins = wins->prev) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9592
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9593 win = wins->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9594
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9595 for (convs = win->gtkconvs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9596 convs != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9597 convs = convs->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9598
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9599 conv = convs->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9600
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9601 if (purple_conversation_get_type(conv->active_conv) == type)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9602 return win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9603 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9604 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9605
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9606 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9607 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9608
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9609
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9610 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9611 * Conversation placement functions
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9612 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9613 typedef struct
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9614 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9615 char *id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9616 char *name;
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
9617 PidginConvPlacementFunc fnc;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9618
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9619 } ConvPlacementData;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9620
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9621 static GList *conv_placement_fncs = NULL;
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
9622 static PidginConvPlacementFunc place_conv = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9623
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9624 /* This one places conversations in the last made window. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9625 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9626 conv_placement_last_created_win(PidginConversation *conv)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9627 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9628 PidginWindow *win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9629
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9630 GList *l = g_list_last(pidgin_conv_windows_get_list());
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9631 win = l ? l->data : NULL;;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9632
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9633 if (win == NULL) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9634 win = pidgin_conv_window_new();
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9635
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9636 g_signal_connect(G_OBJECT(win->window), "configure_event",
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9637 G_CALLBACK(gtk_conv_configure_cb), NULL);
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9638
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9639 pidgin_conv_window_add_gtkconv(win, conv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9640 pidgin_conv_window_show(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9641 } else {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9642 pidgin_conv_window_add_gtkconv(win, conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9643 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9644 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9645
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9646 /* This one places conversations in the last made window of the same type. */
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9647 static gboolean
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9648 conv_placement_last_created_win_type_configured_cb(GtkWidget *w,
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9649 GdkEventConfigure *event, PidginConversation *conv)
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9650 {
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9651 int x, y;
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9652 PurpleConversationType type = purple_conversation_get_type(conv->active_conv);
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9653 GList *all;
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9654
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9655 if (GTK_WIDGET_VISIBLE(w))
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9656 gtk_window_get_position(GTK_WINDOW(w), &x, &y);
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9657 else
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9658 return FALSE; /* carry on normally */
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9659
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9660 /* Workaround for GTK+ bug # 169811 - "configure_event" is fired
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9661 * when the window is being maximized */
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9662 if (gdk_window_get_state(w->window) & GDK_WINDOW_STATE_MAXIMIZED)
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9663 return FALSE;
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9664
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9665 /* don't save off-screen positioning */
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9666 if (x + event->width < 0 ||
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9667 y + event->height < 0 ||
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9668 x > gdk_screen_width() ||
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9669 y > gdk_screen_height())
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9670 return FALSE; /* carry on normally */
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9671
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9672 for (all = conv->convs; all != NULL; all = all->next) {
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9673 if (type != purple_conversation_get_type(all->data)) {
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9674 /* this window has different types of conversation, don't save */
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9675 return FALSE;
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9676 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9677 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9678
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9679 if (type == PURPLE_CONV_TYPE_IM) {
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9680 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/im/x", x);
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9681 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/im/y", y);
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9682 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/im/width", event->width);
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9683 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/im/height", event->height);
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9684 } else if (type == PURPLE_CONV_TYPE_CHAT) {
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9685 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/chat/x", x);
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9686 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/chat/y", y);
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9687 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/chat/width", event->width);
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9688 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/chat/height", event->height);
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9689 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9690
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9691 return FALSE;
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9692 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9693
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9694 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9695 conv_placement_last_created_win_type(PidginConversation *conv)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9696 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9697 PidginWindow *win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9698
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9699 win = pidgin_conv_window_last_with_type(purple_conversation_get_type(conv->active_conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9700
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9701 if (win == NULL) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9702 win = pidgin_conv_window_new();
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9703
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9704 if (PURPLE_CONV_TYPE_IM == purple_conversation_get_type(conv->active_conv) ||
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9705 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/chat/width") == 0) {
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9706 pidgin_conv_set_position_size(win,
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9707 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/im/x"),
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9708 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/im/y"),
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9709 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/im/width"),
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9710 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/im/height"));
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9711 } else if (PURPLE_CONV_TYPE_CHAT == purple_conversation_get_type(conv->active_conv)) {
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9712 pidgin_conv_set_position_size(win,
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9713 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/chat/x"),
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9714 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/chat/y"),
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9715 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/chat/width"),
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9716 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/chat/height"));
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9717 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9718
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9719 pidgin_conv_window_add_gtkconv(win, conv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9720 pidgin_conv_window_show(win);
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9721
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9722 g_signal_connect(G_OBJECT(win->window), "configure_event",
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9723 G_CALLBACK(conv_placement_last_created_win_type_configured_cb), conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9724 } else
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9725 pidgin_conv_window_add_gtkconv(win, conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9726 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9727
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9728 /* This one places each conversation in its own window. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9729 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9730 conv_placement_new_window(PidginConversation *conv)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9731 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9732 PidginWindow *win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9733
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9734 win = pidgin_conv_window_new();
18791
f36fc45b7866 really make restoring size and position work
Ka-Hing Cheung <khc@hxbc.us>
parents: 18790
diff changeset
9735
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9736 g_signal_connect(G_OBJECT(win->window), "configure_event",
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9737 G_CALLBACK(gtk_conv_configure_cb), NULL);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9738
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9739 pidgin_conv_window_add_gtkconv(win, conv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9740
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9741 pidgin_conv_window_show(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9742 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9743
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9744 static PurpleGroup *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9745 conv_get_group(PidginConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9746 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9747 PurpleGroup *group = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9748
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9749 if (purple_conversation_get_type(conv->active_conv) == PURPLE_CONV_TYPE_IM) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9750 PurpleBuddy *buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9751
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9752 buddy = purple_find_buddy(purple_conversation_get_account(conv->active_conv),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9753 purple_conversation_get_name(conv->active_conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9754
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9755 if (buddy != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9756 group = purple_buddy_get_group(buddy);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9757
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9758 } else if (purple_conversation_get_type(conv->active_conv) == PURPLE_CONV_TYPE_CHAT) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9759 PurpleChat *chat;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9760
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9761 chat = purple_blist_find_chat(purple_conversation_get_account(conv->active_conv),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9762 purple_conversation_get_name(conv->active_conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9763
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9764 if (chat != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9765 group = purple_chat_get_group(chat);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9766 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9767
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9768 return group;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9769 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9770
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9771 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9772 * This groups things by, well, group. Buddies from groups will always be
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9773 * grouped together, and a buddy from a group not belonging to any currently
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9774 * open windows will get a new window.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9775 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9776 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9777 conv_placement_by_group(PidginConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9778 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9779 PurpleConversationType type;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9780 PurpleGroup *group = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9781 GList *wl, *cl;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9782
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9783 type = purple_conversation_get_type(conv->active_conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9784
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9785 group = conv_get_group(conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9786
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9787 /* Go through the list of IMs and find one with this group. */
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9788 for (wl = pidgin_conv_windows_get_list(); wl != NULL; wl = wl->next) {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9789 PidginWindow *win2;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9790 PidginConversation *conv2;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9791 PurpleGroup *group2 = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9792
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9793 win2 = wl->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9794
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9795 for (cl = win2->gtkconvs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9796 cl != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9797 cl = cl->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9798 conv2 = cl->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9799
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9800 group2 = conv_get_group(conv2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9801
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9802 if (group == group2) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9803 pidgin_conv_window_add_gtkconv(win2, conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9804
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9805 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9806 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9807 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9808 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9809
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9810 /* Make a new window. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9811 conv_placement_new_window(conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9812 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9813
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9814 /* This groups things by account. Otherwise, the same semantics as above */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9815 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9816 conv_placement_by_account(PidginConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9817 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9818 PurpleConversationType type;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9819 GList *wins, *convs;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9820 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9821
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9822 account = purple_conversation_get_account(conv->active_conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9823 type = purple_conversation_get_type(conv->active_conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9824
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9825 /* Go through the list of IMs and find one with this group. */
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9826 for (wins = pidgin_conv_windows_get_list(); wins != NULL; wins = wins->next) {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9827 PidginWindow *win2;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9828 PidginConversation *conv2;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9829
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9830 win2 = wins->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9831
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9832 for (convs = win2->gtkconvs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9833 convs != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9834 convs = convs->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9835 conv2 = convs->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9836
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9837 if (account == purple_conversation_get_account(conv2->active_conv)) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9838 pidgin_conv_window_add_gtkconv(win2, conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9839 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9840 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9841 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9842 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9843
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9844 /* Make a new window. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9845 conv_placement_new_window(conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9846 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9847
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9848 static ConvPlacementData *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9849 get_conv_placement_data(const char *id)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9850 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9851 ConvPlacementData *data = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9852 GList *n;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9853
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9854 for (n = conv_placement_fncs; n; n = n->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9855 data = n->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9856 if (!strcmp(data->id, id))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9857 return data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9858 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9859
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9860 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9861 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9862
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9863 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9864 add_conv_placement_fnc(const char *id, const char *name,
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
9865 PidginConvPlacementFunc fnc)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9866 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9867 ConvPlacementData *data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9868
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9869 data = g_new(ConvPlacementData, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9870
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9871 data->id = g_strdup(id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9872 data->name = g_strdup(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9873 data->fnc = fnc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9874
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9875 conv_placement_fncs = g_list_append(conv_placement_fncs, data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9876 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9877
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9878 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9879 ensure_default_funcs(void)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9880 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9881 if (conv_placement_fncs == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9882 add_conv_placement_fnc("last", _("Last created window"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9883 conv_placement_last_created_win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9884 add_conv_placement_fnc("im_chat", _("Separate IM and Chat windows"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9885 conv_placement_last_created_win_type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9886 add_conv_placement_fnc("new", _("New window"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9887 conv_placement_new_window);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9888 add_conv_placement_fnc("group", _("By group"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9889 conv_placement_by_group);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9890 add_conv_placement_fnc("account", _("By account"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9891 conv_placement_by_account);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9892 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9893 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9894
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9895 GList *
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9896 pidgin_conv_placement_get_options(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9897 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9898 GList *n, *list = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9899 ConvPlacementData *data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9900
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9901 ensure_default_funcs();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9902
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9903 for (n = conv_placement_fncs; n; n = n->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9904 data = n->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9905 list = g_list_append(list, data->name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9906 list = g_list_append(list, data->id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9907 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9908
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9909 return list;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9910 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9911
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9912
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9913 void
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9914 pidgin_conv_placement_add_fnc(const char *id, const char *name,
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
9915 PidginConvPlacementFunc fnc)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9916 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9917 g_return_if_fail(id != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9918 g_return_if_fail(name != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9919 g_return_if_fail(fnc != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9920
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9921 ensure_default_funcs();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9922
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9923 add_conv_placement_fnc(id, name, fnc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9924 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9925
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9926 void
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9927 pidgin_conv_placement_remove_fnc(const char *id)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9928 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9929 ConvPlacementData *data = get_conv_placement_data(id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9930
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9931 if (data == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9932 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9933
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9934 conv_placement_fncs = g_list_remove(conv_placement_fncs, data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9935
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9936 g_free(data->id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9937 g_free(data->name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9938 g_free(data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9939 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9940
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9941 const char *
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9942 pidgin_conv_placement_get_name(const char *id)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9943 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9944 ConvPlacementData *data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9945
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9946 ensure_default_funcs();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9947
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9948 data = get_conv_placement_data(id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9949
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9950 if (data == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9951 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9952
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9953 return data->name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9954 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9955
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
9956 PidginConvPlacementFunc
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9957 pidgin_conv_placement_get_fnc(const char *id)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9958 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9959 ConvPlacementData *data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9960
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9961 ensure_default_funcs();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9962
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9963 data = get_conv_placement_data(id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9964
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9965 if (data == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9966 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9967
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9968 return data->fnc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9969 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9970
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9971 void
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
9972 pidgin_conv_placement_set_current_func(PidginConvPlacementFunc func)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9973 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9974 g_return_if_fail(func != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9975
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9976 /* If tabs are enabled, set the function, otherwise, NULL it out. */
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
9977 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/tabs"))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9978 place_conv = func;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9979 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9980 place_conv = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9981 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9982
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
9983 PidginConvPlacementFunc
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9984 pidgin_conv_placement_get_current_func(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9985 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9986 return place_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9987 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9988
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9989 void
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9990 pidgin_conv_placement_place(PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9991 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9992 if (place_conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9993 place_conv(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9994 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9995 conv_placement_new_window(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9996 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9997
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9998 gboolean
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9999 pidgin_conv_is_hidden(PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10000 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10001 g_return_val_if_fail(gtkconv != NULL, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10002
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10003 return (gtkconv->win == hidden_convwin);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10004 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10005
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10006
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10007 /* Algorithm from http://www.w3.org/TR/AERT#color-contrast */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10008 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10009 color_is_visible(GdkColor foreground, GdkColor background, int color_contrast, int brightness_contrast)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10010 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10011 gulong fg_brightness;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10012 gulong bg_brightness;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10013 gulong br_diff;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10014 gulong col_diff;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10015 int fred, fgreen, fblue, bred, bgreen, bblue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10016
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10017 /* this algorithm expects colors between 0 and 255 for each of red green and blue.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10018 * GTK on the other hand has values between 0 and 65535
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10019 * Err suggested I >> 8, which grabbed the high bits.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10020 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10021
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10022 fred = foreground.red >> 8 ;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10023 fgreen = foreground.green >> 8 ;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10024 fblue = foreground.blue >> 8 ;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10025
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10026
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10027 bred = background.red >> 8 ;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10028 bgreen = background.green >> 8 ;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10029 bblue = background.blue >> 8 ;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10030
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10031 fg_brightness = (fred * 299 + fgreen * 587 + fblue * 114) / 1000;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10032 bg_brightness = (bred * 299 + bgreen * 587 + bblue * 114) / 1000;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10033 br_diff = abs(fg_brightness - bg_brightness);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10034
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10035 col_diff = abs(fred - bred) + abs(fgreen - bgreen) + abs(fblue - bblue);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10036
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10037 return ((col_diff > color_contrast) && (br_diff > brightness_contrast));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10038 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10039
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10040
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10041 static GdkColor*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10042 generate_nick_colors(guint *color_count, GdkColor background)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10043 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10044 guint numcolors = *color_count;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10045 guint i = 0, j = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10046 GdkColor *colors = g_new(GdkColor, numcolors);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10047 GdkColor nick_highlight;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10048 GdkColor send_color;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10049 time_t breakout_time;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10050
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10051 gdk_color_parse(HIGHLIGHT_COLOR, &nick_highlight);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10052 gdk_color_parse(SEND_COLOR, &send_color);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10053
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10054 srand(background.red + background.green + background.blue + 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10055
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10056 breakout_time = time(NULL) + 3;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10057
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10058 /* first we look through the list of "good" colors: colors that differ from every other color in the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10059 * list. only some of them will differ from the background color though. lets see if we can find
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10060 * numcolors of them that do
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10061 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10062 while (i < numcolors && j < NUM_NICK_SEED_COLORS && time(NULL) < breakout_time)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10063 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10064 GdkColor color = nick_seed_colors[j];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10065
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10066 if (color_is_visible(color, background, MIN_COLOR_CONTRAST, MIN_BRIGHTNESS_CONTRAST) &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10067 color_is_visible(color, nick_highlight, MIN_COLOR_CONTRAST / 2, 0) &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10068 color_is_visible(color, send_color, MIN_COLOR_CONTRAST / 4, 0))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10069 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10070 colors[i] = color;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10071 i++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10072 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10073 j++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10074 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10075
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10076 /* we might not have found numcolors in the last loop. if we did, we'll never enter this one.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10077 * if we did not, lets just find some colors that don't conflict with the background. its
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10078 * expensive to find colors that not only don't conflict with the background, but also do not
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10079 * conflict with each other.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10080 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10081 while(i < numcolors && time(NULL) < breakout_time)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10082 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10083 GdkColor color = { 0, rand() % 65536, rand() % 65536, rand() % 65536 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10084
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10085 if (color_is_visible(color, background, MIN_COLOR_CONTRAST, MIN_BRIGHTNESS_CONTRAST) &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10086 color_is_visible(color, nick_highlight, MIN_COLOR_CONTRAST / 2, 0) &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10087 color_is_visible(color, send_color, MIN_COLOR_CONTRAST / 4, 0))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10088 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10089 colors[i] = color;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10090 i++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10091 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10092 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10093
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10094 if (i < numcolors) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10095 GdkColor *c = colors;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
10096 purple_debug_warning("gtkconv", "Unable to generate enough random colors before timeout. %u colors found.\n", i);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10097 colors = g_memdup(c, i * sizeof(GdkColor));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10098 g_free(c);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10099 *color_count = i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10100 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10101
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10102 return colors;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10103 }