annotate pidgin/gtkconv.c @ 31572:95c33536ac16

ChangeLog and credit where due. Refs #13131.
author John Bailey <rekkanoryo@rekkanoryo.org>
date Sun, 09 Jan 2011 20:10:05 +0000
parents a8cc50c2279f
children fa88dc1dcabb 6e6379254def 917c597beb97
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 */
24292
8282911d5e17 Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents: 24268
diff changeset
27 #define _PIDGIN_GTKCONV_C_
8282911d5e17 Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents: 24268
diff changeset
28
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 #include "internal.h"
15514
535f002e7b0f More pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15509
diff changeset
30 #include "pidgin.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32 #ifndef _WIN32
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 # include <X11/Xlib.h>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 #ifdef USE_GTKSPELL
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37 # include <gtkspell/gtkspell.h>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38 # ifdef _WIN32
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39 # include "wspell.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40 # endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41 #endif
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 <gdk/gdkkeysyms.h>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45 #include "account.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46 #include "cmds.h"
26259
85bb3539d302 And make that actually compile.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26258
diff changeset
47 #include "core.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48 #include "debug.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49 #include "idle.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50 #include "imgstore.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51 #include "log.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52 #include "notify.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53 #include "prpl.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54 #include "request.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55 #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
56 #include "version.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58 #include "gtkdnd-hints.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59 #include "gtkblist.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60 #include "gtkconv.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
61 #include "gtkconvwin.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
62 #include "gtkdialogs.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
63 #include "gtkimhtml.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
64 #include "gtkimhtmltoolbar.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65 #include "gtklog.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
66 #include "gtkmenutray.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
67 #include "gtkpounce.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
68 #include "gtkprefs.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
69 #include "gtkprivacy.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
70 #include "gtkthemes.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
71 #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
72 #include "pidginstock.h"
21945
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
73 #include "pidgintooltip.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
74
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
75 #include "gtknickcolors.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
76
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
77 #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
78
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
79 #define AUTO_RESPONSE "&lt;AUTO-REPLY&gt; : "
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
80
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
81 typedef enum
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
83 PIDGIN_CONV_SET_TITLE = 1 << 0,
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
84 PIDGIN_CONV_BUDDY_ICON = 1 << 1,
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
85 PIDGIN_CONV_MENU = 1 << 2,
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
86 PIDGIN_CONV_TAB_ICON = 1 << 3,
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
87 PIDGIN_CONV_TOPIC = 1 << 4,
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
88 PIDGIN_CONV_SMILEY_THEME = 1 << 5,
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
89 PIDGIN_CONV_COLORIZE_TITLE = 1 << 6
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
90 }PidginConvFields;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
91
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
92 enum {
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
93 CONV_ICON_COLUMN,
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
94 CONV_TEXT_COLUMN,
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
95 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
96 CONV_PROTOCOL_ICON_COLUMN,
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
97 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
98 } 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
99
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
100 #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
101
23005
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
102 /* XXX: These color defines shouldn't really be here. But the nick-color
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
103 * generation algorithm uses them, so keeping these around until we fix that. */
21840
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
104 #define DEFAULT_SEND_COLOR "#204a87"
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
105 #define DEFAULT_HIGHLIGHT_COLOR "#AF7F00"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106
22733
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
107 #define BUDDYICON_SIZE_MIN 32
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
108 #define BUDDYICON_SIZE_MAX 96
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
109
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110 /* 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
111 #define DEBUG_CUSTOM_SMILEY
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113 #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
114
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 /* 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
116 #define MIN_BRIGHTNESS_CONTRAST 75
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117 #define MIN_COLOR_CONTRAST 200
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119 #define NUM_NICK_COLORS 220
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
120 static GdkColor *nick_colors = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121 static guint nbr_nick_colors;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123 typedef struct {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124 GtkWidget *window;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126 GtkWidget *entry;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127 GtkWidget *message;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
129 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131 } InviteBuddyInfo;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133 static GtkWidget *invite_dialog = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 static GtkWidget *warn_close_dialog = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
136 static PidginWindow *hidden_convwin = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137 static GList *window_list = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
139 /* 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
140 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
141 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
142 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
143 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
144 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
145 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
146 static GList *offline_list = NULL;
15724
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
147 static GHashTable *prpl_lists = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
149 static gboolean update_send_to_selection(PidginWindow *win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
150 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
151
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
152 /* Prototypes. <-- because Paco-Paco hates this comment. */
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
153 static gboolean infopane_entry_activate(PidginConversation *gtkconv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
154 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
155 static void gray_stuff_out(PidginConversation *gtkconv);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
156 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
157 static gboolean tab_complete(PurpleConversation *conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
158 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
159 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
160 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
161 static void update_typing_icon(PidginConversation *gtkconv);
21875
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
162 static void update_typing_message(PidginConversation *gtkconv, const char *message);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
163 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
164 gboolean pidgin_conv_has_focus(PurpleConversation *conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
165 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
166 static gboolean color_is_visible(GdkColor foreground, GdkColor background, int color_contrast, int brightness_contrast);
24267
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
167 static GtkTextTag *get_buddy_tag(PurpleConversation *conv, const char *who, PurpleMessageFlags flag, gboolean create);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
168 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
169 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
170 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
171 static gboolean infopane_press_cb(GtkWidget *widget, GdkEventButton *e, PidginConversation *conv);
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
172 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
173
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
174 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
175 int width, int height);
22193
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
176 static gboolean pidgin_conv_xy_to_right_infopane(PidginWindow *win, int x, int y);
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
177
24267
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
178 static const GdkColor *get_nick_color(PidginConversation *gtkconv, const char *name)
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
179 {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180 static GdkColor col;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
181 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
182 float scale;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
183
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184 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
185 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
186 (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
187
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188 /* 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
189 if (scale > 1) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
190 col.red *= scale;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191 col.green *= scale;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
192 col.blue *= scale;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
195 return &col;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
196 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197
19980
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
198 static PurpleBlistNode *
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
199 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
200 {
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
201 PurpleBlistNode *node = NULL;
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
202
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
203 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
204 case PURPLE_CONV_TYPE_IM:
25318
0e08c847517d Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents: 24292
diff changeset
205 node = PURPLE_BLIST_NODE(purple_find_buddy(conv->account, conv->name));
19980
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
206 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
207 break;
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
208 case PURPLE_CONV_TYPE_CHAT:
25318
0e08c847517d Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents: 24292
diff changeset
209 node = PURPLE_BLIST_NODE(purple_blist_find_chat(conv->account, conv->name));
19980
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
210 break;
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
211 default:
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
212 break;
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
213 }
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
214 return node;
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
215 }
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
216
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
217 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
218 * Callbacks
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
220
18797
0622a7f08dde smaller close buttons on tabs. I think this looks really good.
Sean Egan <seanegan@gmail.com>
parents: 18796
diff changeset
221 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
222 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
223 {
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
224 PidginConversation *gtkconv = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
225 GList *list = g_list_copy(gtkconv->convs);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
226 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
227 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
228 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
229 }
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 static gboolean
30016
97005a2e99d7 Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents: 29750
diff changeset
232 close_conv_cb(GtkButton *button, 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
233 {
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 /* 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
235 * 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
236 * (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
237 * 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
238 * 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
239 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
240 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
241 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
242
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
243 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
244 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
245 {
22287
36036b9489fe Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <stu@nosnilmot.com>
parents: 22281
diff changeset
246 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/im/close_immediately"))
36036b9489fe Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <stu@nosnilmot.com>
parents: 22281
diff changeset
247 close_this_sucker(gtkconv);
36036b9489fe Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <stu@nosnilmot.com>
parents: 22281
diff changeset
248 else
36036b9489fe Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <stu@nosnilmot.com>
parents: 22281
diff changeset
249 hide_conv(gtkconv, TRUE);
21671
12b165b013e4 Fix a crash.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21665
diff changeset
250 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
251 }
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 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
253 {
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 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
255 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
256 !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
257 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
258 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
259 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
260 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
261 }
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
262 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
263 ;
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
264 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
265
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266 return TRUE;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
269 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270 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
271 {
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
272 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
273
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
274 return FALSE;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
277 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
278 default_formatize(PidginConversation *c)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
279 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
280 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
281 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
282 }
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 static void
30579
e9f4deddddd8 Reset 'undo' history when a message is sent.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 30134
diff changeset
285 conversation_entry_clear(PidginConversation *gtkconv)
e9f4deddddd8 Reset 'undo' history when a message is sent.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 30134
diff changeset
286 {
e9f4deddddd8 Reset 'undo' history when a message is sent.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 30134
diff changeset
287 GtkIMHtml *imhtml = GTK_IMHTML(gtkconv->entry);
e9f4deddddd8 Reset 'undo' history when a message is sent.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 30134
diff changeset
288 gtk_source_undo_manager_begin_not_undoable_action(imhtml->undo_manager);
e9f4deddddd8 Reset 'undo' history when a message is sent.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 30134
diff changeset
289 gtk_imhtml_clear(imhtml);
e9f4deddddd8 Reset 'undo' history when a message is sent.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 30134
diff changeset
290 gtk_source_undo_manager_end_not_undoable_action(imhtml->undo_manager);
e9f4deddddd8 Reset 'undo' history when a message is sent.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 30134
diff changeset
291 }
e9f4deddddd8 Reset 'undo' history when a message is sent.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 30134
diff changeset
292
e9f4deddddd8 Reset 'undo' history when a message is sent.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 30134
diff changeset
293 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
294 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
295 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
296 default_formatize(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
297 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
298
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
299 static const char *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
300 pidgin_get_cmd_prefix(void)
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 return "/";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
303 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
304
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
305 static PurpleCmdRet
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
306 say_command_cb(PurpleConversation *conv,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
307 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
308 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
309 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
310 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
311 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
312 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
313
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
314 return PURPLE_CMD_RET_OK;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
315 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
316
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
317 static PurpleCmdRet
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
318 me_command_cb(PurpleConversation *conv,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
319 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
320 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
321 char *tmp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
322
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
323 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
324
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
325 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
326 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
327 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
328 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
329
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
330 g_free(tmp);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
331 return PURPLE_CMD_RET_OK;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
332 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
333
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
334 static PurpleCmdRet
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
335 debug_command_cb(PurpleConversation *conv,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
336 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
337 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
338 char *tmp, *markup;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
339
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
340 if (!g_ascii_strcasecmp(args[0], "version")) {
28628
574fd92ff3e5 '/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28626
diff changeset
341 tmp = g_strdup_printf("Using Pidgin v%s with libpurple v%s.",
26258
c1019839ddec Add libpurple version to '/debug version' output.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 25438
diff changeset
342 DISPLAY_VERSION, purple_core_get_version());
28628
574fd92ff3e5 '/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28626
diff changeset
343 } else if (!g_ascii_strcasecmp(args[0], "plugins")) {
574fd92ff3e5 '/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28626
diff changeset
344 /* Show all the loaded plugins, including the protocol plugins and plugin loaders.
574fd92ff3e5 '/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28626
diff changeset
345 * This is intentional, since third party prpls are often sources of bugs, and some
574fd92ff3e5 '/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28626
diff changeset
346 * plugin loaders (e.g. mono) can also be buggy.
574fd92ff3e5 '/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28626
diff changeset
347 */
574fd92ff3e5 '/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28626
diff changeset
348 GString *str = g_string_new("Loaded Plugins: ");
574fd92ff3e5 '/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28626
diff changeset
349 const GList *plugins = purple_plugins_get_loaded();
574fd92ff3e5 '/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28626
diff changeset
350 if (plugins) {
574fd92ff3e5 '/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28626
diff changeset
351 for (; plugins; plugins = plugins->next) {
574fd92ff3e5 '/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28626
diff changeset
352 str = g_string_append(str, purple_plugin_get_name(plugins->data));
574fd92ff3e5 '/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28626
diff changeset
353 if (plugins->next)
574fd92ff3e5 '/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28626
diff changeset
354 str = g_string_append(str, ", ");
574fd92ff3e5 '/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28626
diff changeset
355 }
574fd92ff3e5 '/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28626
diff changeset
356 } else {
574fd92ff3e5 '/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28626
diff changeset
357 str = g_string_append(str, "(none)");
574fd92ff3e5 '/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28626
diff changeset
358 }
574fd92ff3e5 '/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28626
diff changeset
359
574fd92ff3e5 '/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28626
diff changeset
360 tmp = g_string_free(str, FALSE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
361 } else {
28628
574fd92ff3e5 '/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28626
diff changeset
362 purple_conversation_write(conv, NULL, _("Supported debug options are: plugins version"),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
363 PURPLE_MESSAGE_NO_LOG|PURPLE_MESSAGE_ERROR, time(NULL));
28629
f15b14df260d Return the proper enum values from command callbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28628
diff changeset
364 return PURPLE_CMD_RET_OK;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
365 }
28628
574fd92ff3e5 '/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28626
diff changeset
366
574fd92ff3e5 '/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28626
diff changeset
367 markup = g_markup_escape_text(tmp, -1);
574fd92ff3e5 '/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28626
diff changeset
368 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM)
574fd92ff3e5 '/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28626
diff changeset
369 purple_conv_im_send(PURPLE_CONV_IM(conv), markup);
574fd92ff3e5 '/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28626
diff changeset
370 else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT)
574fd92ff3e5 '/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28626
diff changeset
371 purple_conv_chat_send(PURPLE_CONV_CHAT(conv), markup);
574fd92ff3e5 '/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28626
diff changeset
372
574fd92ff3e5 '/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28626
diff changeset
373 g_free(tmp);
574fd92ff3e5 '/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28626
diff changeset
374 g_free(markup);
28629
f15b14df260d Return the proper enum values from command callbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28628
diff changeset
375 return PURPLE_CMD_RET_OK;
15823
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
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
378 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
379 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
380 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
381 GList *iter;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
382
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
383 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
384
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
385 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
386 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
387 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
388 }
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 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
391 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
392 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
393 {
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 clear_conversation_scrollback(conv);
28629
f15b14df260d Return the proper enum values from command callbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28628
diff changeset
395 return PURPLE_CMD_RET_OK;
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
396 }
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 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
399 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
400 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
401 {
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 purple_conversation_foreach(clear_conversation_scrollback);
28629
f15b14df260d Return the proper enum values from command callbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28628
diff changeset
403 return PURPLE_CMD_RET_OK;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
404 }
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 static PurpleCmdRet
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
407 help_command_cb(PurpleConversation *conv,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
408 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
409 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
410 GList *l, *text;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
411 GString *s;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
412
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
413 if (args[0] != NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
414 s = g_string_new("");
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
415 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
416
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
417 if (text) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
418 for (l = text; l; l = l->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
419 if (l->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
420 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
421 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
422 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
423 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
424 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
425 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
426 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
427 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
428 "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
429
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
430 text = purple_cmd_list(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
431 for (l = text; l; l = l->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
432 if (l->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
433 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
434 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
435 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
436 g_list_free(text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
437 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
438
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
439 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
440 g_string_free(s, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
441
28629
f15b14df260d Return the proper enum values from command callbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28628
diff changeset
442 return PURPLE_CMD_RET_OK;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
443 }
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 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
446 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
447 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
448 GList *first;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
449
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
450 first = g_list_first(gtkconv->send_history);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
451 g_free(first->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
452 first->data = g_strdup(message);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
453 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
454 }
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 static gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
457 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
458 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
459 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
460 char *cmd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
461 const char *prefix;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
462 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
463 gboolean retval = FALSE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
464
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
465 gtkconv = PIDGIN_CONVERSATION(conv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
466 prefix = pidgin_get_cmd_prefix();
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 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
469 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
470
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
471 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
472 && !gtk_text_iter_get_child_anchor(&start)) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
473 PurpleCmdStatus status;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
474 char *error, *cmdline, *markup, *send_history;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
475 GtkTextIter end;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
476
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
477 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
478 send_history_add(gtkconv, send_history);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
479 g_free(send_history);
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 cmdline = cmd + strlen(prefix);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
482
22104
52d7368fdc1c I'm gonna try adding in an easter egg here, see what people thing.
Mark Doliner <mark@kingant.net>
parents: 22038
diff changeset
483 if (strcmp(cmdline, "xyzzy") == 0) {
52d7368fdc1c I'm gonna try adding in an easter egg here, see what people thing.
Mark Doliner <mark@kingant.net>
parents: 22038
diff changeset
484 purple_conversation_write(conv, "", "Nothing happens",
52d7368fdc1c I'm gonna try adding in an easter egg here, see what people thing.
Mark Doliner <mark@kingant.net>
parents: 22038
diff changeset
485 PURPLE_MESSAGE_NO_LOG, time(NULL));
52d7368fdc1c I'm gonna try adding in an easter egg here, see what people thing.
Mark Doliner <mark@kingant.net>
parents: 22038
diff changeset
486 g_free(cmd);
52d7368fdc1c I'm gonna try adding in an easter egg here, see what people thing.
Mark Doliner <mark@kingant.net>
parents: 22038
diff changeset
487 return TRUE;
52d7368fdc1c I'm gonna try adding in an easter egg here, see what people thing.
Mark Doliner <mark@kingant.net>
parents: 22038
diff changeset
488 }
52d7368fdc1c I'm gonna try adding in an easter egg here, see what people thing.
Mark Doliner <mark@kingant.net>
parents: 22038
diff changeset
489
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
490 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
491 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
492 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
493 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
494 g_free(markup);
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 switch (status) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
497 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
498 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
499 break;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
500 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
501 {
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
502 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
503 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
504
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
505 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
506 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
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 if ((prpl_info != NULL) && (prpl_info->options & OPT_PROTO_SLASH_COMMANDS_NATIVE)) {
29358
5f6571bb128d Fix sending '/messages/like/this '.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29307
diff changeset
509 char *spaceslash;
5f6571bb128d Fix sending '/messages/like/this '.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29307
diff changeset
510
5f6571bb128d Fix sending '/messages/like/this '.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29307
diff changeset
511 /* If the first word in the entered text has a '/' in it, then the user
5f6571bb128d Fix sending '/messages/like/this '.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29307
diff changeset
512 * probably didn't mean it as a command. So send the text as message. */
5f6571bb128d Fix sending '/messages/like/this '.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29307
diff changeset
513 spaceslash = cmdline;
5f6571bb128d Fix sending '/messages/like/this '.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29307
diff changeset
514 while (*spaceslash && *spaceslash != ' ' && *spaceslash != '/')
5f6571bb128d Fix sending '/messages/like/this '.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29307
diff changeset
515 spaceslash++;
5f6571bb128d Fix sending '/messages/like/this '.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29307
diff changeset
516
5f6571bb128d Fix sending '/messages/like/this '.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29307
diff changeset
517 if (*spaceslash != '/') {
18030
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
518 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
519 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
520 }
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
521 }
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
522 break;
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
523 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
524 case PURPLE_CMD_STATUS_WRONG_ARGS:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
525 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
526 "to that command."),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
527 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
528 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
529 break;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
530 case PURPLE_CMD_STATUS_FAILED:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
531 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
532 PURPLE_MESSAGE_NO_LOG, time(NULL));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
533 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
534 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
535 break;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
536 case PURPLE_CMD_STATUS_WRONG_TYPE:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
537 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
538 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
539 PURPLE_MESSAGE_NO_LOG, time(NULL));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
540 else
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
541 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
542 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
543 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
544 break;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
545 case PURPLE_CMD_STATUS_WRONG_PRPL:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
546 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
547 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
548 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
549 break;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
550 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
551 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
552
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
553 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
554 return retval;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
555 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
556
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
557 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
558 send_cb(GtkWidget *widget, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
559 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
560 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
561 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
562 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
563 PurpleMessageFlags flags = 0;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
564 char *buf, *clean;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
565
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
566 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
567
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
568 if (check_for_and_do_command(conv)) {
30579
e9f4deddddd8 Reset 'undo' history when a message is sent.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 30134
diff changeset
569 conversation_entry_clear(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
570 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
571 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
572
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
573 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
574 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
575 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
576
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
577 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
578 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
579
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
580 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
581 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
582
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
583 gtk_widget_grab_focus(gtkconv->entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
584
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
585 if (strlen(clean) == 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
586 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
587 g_free(clean);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
588 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
589 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
590
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
591 purple_idle_touch();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
592
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
593 /* 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
594 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
595 flags |= PURPLE_MESSAGE_IMAGES;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
596
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
597 gc = purple_account_get_connection(account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
598 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
599 char **bufs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
600 int i;
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 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
603 for (i = 0; bufs[i]; i++) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
604 send_history_add(gtkconv, bufs[i]);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
605 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
606 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
607 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
608 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
609 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
610
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
611 g_strfreev(bufs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
612
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
613 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
614 send_history_add(gtkconv, buf);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
615 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
616 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
617 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
618 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
619 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
620
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
621 g_free(clean);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
622 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
623
30579
e9f4deddddd8 Reset 'undo' history when a message is sent.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 30134
diff changeset
624 conversation_entry_clear(gtkconv);
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
625 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
626 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
627
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
628 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
629 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
630 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
631 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
632 const char *name;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
633 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
634
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
635 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
636 name = purple_conversation_get_name(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
637
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
638 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
639 PurpleBuddy *b;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
640
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
641 b = purple_find_buddy(account, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
642 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
643 pidgin_dialogs_remove_buddy(b);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
644 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
645 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
646 } 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
647 PurpleChat *c;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
648
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
649 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
650 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
651 pidgin_dialogs_remove_chat(c);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
652 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
653 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
654 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
655
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
656 gtk_widget_grab_focus(PIDGIN_CONVERSATION(conv)->entry);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
657 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
658
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
659 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
660 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
661 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
662 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
663
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
664 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
665 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
666 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
667 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
668
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
669
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
670 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
671 info_cb(GtkWidget *widget, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
672 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
673 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
674
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
675 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
676 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
677 purple_conversation_get_name(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
678 gtk_widget_grab_focus(gtkconv->entry);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
679 } 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
680 /* 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
681 PidginChatPane *gtkchat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
682 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
683 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
684 GtkTreeSelection *sel;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
685 char *name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
686
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
687 gtkchat = gtkconv->u.chat;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
688
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
689 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
690 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
691
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
692 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
693 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
694 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
695 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
696
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
697 chat_do_info(gtkconv, name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
698 g_free(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
699 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
700 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
701
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
702 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
703 block_cb(GtkWidget *widget, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
704 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
705 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
706 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
707
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
708 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
709
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
710 if (account != NULL && purple_account_is_connected(account))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
711 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
712
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
713 gtk_widget_grab_focus(PIDGIN_CONVERSATION(conv)->entry);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
714 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
715
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
716 static void
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
717 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
718 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
719 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
720 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
721
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
722 account = purple_conversation_get_account(conv);
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 if (account != NULL && purple_account_is_connected(account))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
725 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
726
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
727 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
728 }
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
729
22843
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
730 static gboolean
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
731 chat_invite_filter(const PidginBuddyCompletionEntry *entry, gpointer data)
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
732 {
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
733 PurpleAccount *filter_account = data;
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
734 PurpleAccount *account = NULL;
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
735
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
736 if (entry->is_buddy) {
22844
396fd93907f1 Add only the online buddies for auto-completion in the invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22843
diff changeset
737 if (PURPLE_BUDDY_IS_ONLINE(entry->entry.buddy))
396fd93907f1 Add only the online buddies for auto-completion in the invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22843
diff changeset
738 account = purple_buddy_get_account(entry->entry.buddy);
396fd93907f1 Add only the online buddies for auto-completion in the invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22843
diff changeset
739 else
396fd93907f1 Add only the online buddies for auto-completion in the invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22843
diff changeset
740 return FALSE;
22843
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
741 } else {
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
742 account = entry->entry.logged_buddy->account;
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
743 }
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
744 if (account == filter_account)
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
745 return TRUE;
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
746 return FALSE;
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
747 }
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
748
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
749 static void
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
750 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
751 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
752 const char *buddy, *message;
30863
351d07aefb09 Kill off many dead assignments and any useless remaining variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30579
diff changeset
753 PurpleConversation *conv;
351d07aefb09 Kill off many dead assignments and any useless remaining variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30579
diff changeset
754
351d07aefb09 Kill off many dead assignments and any useless remaining variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30579
diff changeset
755 conv = info->conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
756
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
757 if (resp == GTK_RESPONSE_OK) {
22843
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
758 buddy = gtk_entry_get_text(GTK_ENTRY(info->entry));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
759 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
760
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
761 if (!g_ascii_strcasecmp(buddy, ""))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
762 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
763
30863
351d07aefb09 Kill off many dead assignments and any useless remaining variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30579
diff changeset
764 serv_chat_invite(purple_conversation_get_gc(conv),
351d07aefb09 Kill off many dead assignments and any useless remaining variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30579
diff changeset
765 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
766 message, buddy);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
767 }
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 gtk_widget_destroy(invite_dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
770 invite_dialog = NULL;
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 g_free(info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
773 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
774
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
775 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
776 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
777 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
778 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
779 InviteBuddyInfo *info = (InviteBuddyInfo *)data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
780 const char *convprotocol;
22843
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
781 gboolean success = TRUE;
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 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
784
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
785 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
786 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
787 PurpleBlistNode *node = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
788 PurpleBuddy *buddy;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
789
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
790 memcpy(&node, sd->data, sizeof(node));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
791
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
792 if (PURPLE_BLIST_NODE_IS_CONTACT(node))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
793 buddy = purple_contact_get_priority_buddy((PurpleContact *)node);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
794 else if (PURPLE_BLIST_NODE_IS_BUDDY(node))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
795 buddy = (PurpleBuddy *)node;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
796 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
797 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
798
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
799 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
800 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
801 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
802 _("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
803 "chat."), NULL);
22843
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
804 success = FALSE;
15374
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
22843
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
807 gtk_entry_set_text(GTK_ENTRY(info->entry), purple_buddy_get_name(buddy));
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
808
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
809 gtk_drag_finish(dc, success, (dc->action == GDK_ACTION_MOVE), t);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
810 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
811 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
812 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
813 char *protocol = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
814 char *username = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
815 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
816
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
817 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
818 &protocol, &username, NULL))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
819 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
820 if (account == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
821 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
822 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
823 _("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
824 "can invite that buddy."), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
825 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
826 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
827 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
828 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
829 _("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
830 "chat."), NULL);
22843
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
831 success = FALSE;
15374
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 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
834 {
22843
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
835 gtk_entry_set_text(GTK_ENTRY(info->entry), username);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
836 }
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 g_free(username);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
840 g_free(protocol);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
841
22843
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
842 gtk_drag_finish(dc, success, (dc->action == GDK_ACTION_MOVE), t);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
843 }
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 const GtkTargetEntry dnd_targets[] =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
847 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
848 {"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
849 {"application/x-im-contact", 0, 1}
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
850 };
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 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
853 invite_cb(GtkWidget *widget, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
854 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
855 PurpleConversation *conv = gtkconv->active_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
856 InviteBuddyInfo *info = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
857
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
858 if (invite_dialog == NULL) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
859 PidginWindow *gtkwin;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
860 GtkWidget *label;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
861 GtkWidget *vbox, *hbox;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
862 GtkWidget *table;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
863 GtkWidget *img;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
864
15436
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15435
diff changeset
865 img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_QUESTION,
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15435
diff changeset
866 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
867
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
868 info = g_new0(InviteBuddyInfo, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
869 info->conv = conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
870
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
871 gtkwin = pidgin_conv_get_window(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
872
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
873 /* Create the new dialog. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
874 invite_dialog = gtk_dialog_new_with_buttons(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
875 _("Invite Buddy Into Chat Room"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
876 GTK_WINDOW(gtkwin->window), 0,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
877 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
15509
23ca11f8a8c4 stock to pidgin
Sean Egan <seanegan@gmail.com>
parents: 15508
diff changeset
878 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
879
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
880 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
881 GTK_RESPONSE_OK);
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
882 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
883 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
884 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
885
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
886 info->window = GTK_WIDGET(invite_dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
887
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
888 /* Setup the outside spacing. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
889 vbox = GTK_DIALOG(invite_dialog)->vbox;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
890
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
891 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
892 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
893
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
894 /* 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
895 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
896 gtk_container_add(GTK_CONTAINER(vbox), hbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
897 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
898 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
899
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
900 /* Setup the right vbox. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
901 vbox = gtk_vbox_new(FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
902 gtk_container_add(GTK_CONTAINER(hbox), vbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
903
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
904 /* Put our happy label in it. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
905 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
906 "to invite, along with an optional invite "
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
907 "message."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
908 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
909 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
910 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
911 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
912
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
913 /* 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
914 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
915 gtk_container_add(GTK_CONTAINER(vbox), hbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
916
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
917 /* 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
918 table = gtk_table_new(2, 2, FALSE);
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
919 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
920 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
921 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
922 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
923
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
924 /* Now the Buddy label */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
925 label = gtk_label_new(NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
926 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
927 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
928 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
929
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
930 /* Now the Buddy drop-down entry field. */
22843
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
931 info->entry = gtk_entry_new();
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
932 pidgin_setup_screenname_autocomplete_with_filter(info->entry, NULL, chat_invite_filter,
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
933 purple_conversation_get_account(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
934 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
935 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
936
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
937 /* Now the label for "Message" */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
938 label = gtk_label_new(NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
939 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
940 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
941 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
942
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
943
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
944 /* And finally, the Message entry field. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
945 info->message = gtk_entry_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
946 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
947
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
948 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
949 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
950
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
951 /* Connect the signals. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
952 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
953 G_CALLBACK(do_invite), info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
954 /* Setup drag-and-drop */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
955 gtk_drag_dest_set(info->window,
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 gtk_drag_dest_set(info->entry,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
962 GTK_DEST_DEFAULT_MOTION |
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
963 GTK_DEST_DEFAULT_DROP,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
964 dnd_targets,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
965 sizeof(dnd_targets) / sizeof(GtkTargetEntry),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
966 GDK_ACTION_COPY);
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 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
969 G_CALLBACK(invite_dnd_recv), info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
970 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
971 G_CALLBACK(invite_dnd_recv), info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
972 }
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 gtk_widget_show_all(invite_dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
975
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
976 if (info != NULL)
22843
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
977 gtk_widget_grab_focus(info->entry);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
978 }
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 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
981 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
982 {
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
983 pidgin_dialogs_im();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
984 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
985
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
986 static void
28318
38f09799476a Didn't realize I hadn't pushed this before the string freeze so we get to do
Etan Reisner <pidgin@unreliablesource.net>
parents: 27603
diff changeset
987 menu_join_chat_cb(gpointer data, guint action, GtkWidget *widget)
38f09799476a Didn't realize I hadn't pushed this before the string freeze so we get to do
Etan Reisner <pidgin@unreliablesource.net>
parents: 27603
diff changeset
988 {
38f09799476a Didn't realize I hadn't pushed this before the string freeze so we get to do
Etan Reisner <pidgin@unreliablesource.net>
parents: 27603
diff changeset
989 pidgin_blist_joinchat_show();
38f09799476a Didn't realize I hadn't pushed this before the string freeze so we get to do
Etan Reisner <pidgin@unreliablesource.net>
parents: 27603
diff changeset
990 }
38f09799476a Didn't realize I hadn't pushed this before the string freeze so we get to do
Etan Reisner <pidgin@unreliablesource.net>
parents: 27603
diff changeset
991
38f09799476a Didn't realize I hadn't pushed this before the string freeze so we get to do
Etan Reisner <pidgin@unreliablesource.net>
parents: 27603
diff changeset
992 static void
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
993 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
994 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
995 PurpleConversation *conv = (PurpleConversation *)user_data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
996 FILE *fp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
997 const char *name;
19665
37429bc82307 I think this fixes #2858.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19655
diff changeset
998 char **lines;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
999 gchar *text;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1000
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1001 if ((fp = g_fopen(filename, "w+")) == NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1002 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
1003 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1004 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1005
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1006 name = purple_conversation_get_name(conv);
24323
dd155ec42b25 When you choose Save As from the Conversation menu in Pidgin, the saved file
Richard Laager <rlaager@wiktel.com>
parents: 24292
diff changeset
1007 fprintf(fp, "<html>\n<head>\n");
dd155ec42b25 When you choose Save As from the Conversation menu in Pidgin, the saved file
Richard Laager <rlaager@wiktel.com>
parents: 24292
diff changeset
1008 fprintf(fp, "<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n");
dd155ec42b25 When you choose Save As from the Conversation menu in Pidgin, the saved file
Richard Laager <rlaager@wiktel.com>
parents: 24292
diff changeset
1009 fprintf(fp, "<title>%s</title>\n</head>\n<body>\n", name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1010 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
1011
19665
37429bc82307 I think this fixes #2858.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19655
diff changeset
1012 lines = gtk_imhtml_get_markup_lines(
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1013 GTK_IMHTML(PIDGIN_CONVERSATION(conv)->imhtml));
19667
a2f5a28ba983 More fix, thanks to SimGuy.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19665
diff changeset
1014 text = g_strjoinv("<br>\n", lines);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1015 fprintf(fp, "%s", text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1016 g_free(text);
19665
37429bc82307 I think this fixes #2858.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19655
diff changeset
1017 g_strfreev(lines);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1018
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1019 fprintf(fp, "\n</body>\n</html>\n");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1020 fclose(fp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1021 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1022
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1023 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1024 * 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
1025 * plaintext v. HTML file.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1026 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1027 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1028 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
1029 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1030 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1031 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
1032 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
1033 const char *name;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1034 gchar *buf;
17195
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1035 gchar *c;
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1036
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1037 if (buddy != NULL)
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1038 name = purple_buddy_get_contact_alias(buddy);
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1039 else
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1040 name = purple_normalize(conv->account, conv->name);
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1041
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1042 buf = g_strdup_printf("%s.html", name);
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1043 for (c = buf ; *c ; c++)
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1044 {
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1045 if (*c == '/' || *c == '\\')
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1046 *c = ' ';
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1047 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1048 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
1049 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
1050 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
1051 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
1052 conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1053
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1054 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1055 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1056
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1057 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1058 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
1059 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1060 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1061 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1062 PurpleLogType type;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1063 PidginBuddyList *gtkblist;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1064 GdkCursor *cursor;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1065 const char *name;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1066 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1067 GSList *buddies;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1068 GSList *cur;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1069
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1070 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
1071
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1072 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
1073 type = PURPLE_LOG_IM;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1074 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
1075 type = PURPLE_LOG_CHAT;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1076 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1077 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1078
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1079 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
1080
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1081 cursor = gdk_cursor_new(GDK_WATCH);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1082 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
1083 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
1084 gdk_cursor_unref(cursor);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1085 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
1086
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1087 name = purple_conversation_get_name(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1088 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1089
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1090 buddies = purple_find_buddies(account, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1091 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
1092 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1093 PurpleBlistNode *node = cur->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1094 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
1095 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1096 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
1097 g_slist_free(buddies);
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 return;
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1103 g_slist_free(buddies);
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 pidgin_log_show(type, name, account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1106
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1107 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
1108 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
1109 }
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 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1112 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
1113 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1114 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1115 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1116
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1117 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
1118 clear_conversation_scrollback(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1119 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1120
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1121 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1122 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
1123 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1124 PidginWindow *gtkwin = data;
29718
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
1125 PidginConversation *gtkconv = pidgin_conv_window_get_active_gtkconv(gtkwin);
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
1126 gtk_widget_show_all(gtkconv->quickfind.container);
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
1127 gtk_widget_grab_focus(gtkconv->quickfind.entry);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1128 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1129
25654
cbe97caec684 Use USE_VV instead of USE_FARSIGHT.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25651
diff changeset
1130 #ifdef USE_VV
31534
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 31517
diff changeset
1131 static void
26144
2091094745d9 Simplify the media menu callbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
1132 menu_initiate_media_call_cb(gpointer data, guint action, GtkWidget *widget)
2091094745d9 Simplify the media menu callbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
1133 {
2091094745d9 Simplify the media menu callbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
1134 PidginWindow *win = (PidginWindow *)data;
2091094745d9 Simplify the media menu callbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
1135 PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win);
2091094745d9 Simplify the media menu callbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
1136 PurpleAccount *account = purple_conversation_get_account(conv);
2091094745d9 Simplify the media menu callbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
1137
2091094745d9 Simplify the media menu callbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
1138 purple_prpl_initiate_media(account,
2091094745d9 Simplify the media menu callbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
1139 purple_conversation_get_name(conv),
2091094745d9 Simplify the media menu callbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
1140 action == 0 ? PURPLE_MEDIA_AUDIO :
2091094745d9 Simplify the media menu callbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
1141 action == 1 ? PURPLE_MEDIA_VIDEO :
2091094745d9 Simplify the media menu callbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
1142 action == 2 ? PURPLE_MEDIA_AUDIO |
2091094745d9 Simplify the media menu callbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
1143 PURPLE_MEDIA_VIDEO : PURPLE_MEDIA_NONE);
2091094745d9 Simplify the media menu callbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
1144 }
25637
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25636
diff changeset
1145 #endif
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25636
diff changeset
1146
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1147 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1148 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
1149 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1150 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1151 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
1152
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1153 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
1154 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
1155 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1156
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1157 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1158
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1159 static void
29638
22b8a92fb5ee Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents: 23998
diff changeset
1160 menu_get_attention_cb(gpointer data, guint action, GtkWidget *widget)
22b8a92fb5ee Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents: 23998
diff changeset
1161 {
22b8a92fb5ee Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents: 23998
diff changeset
1162 PidginWindow *win = data;
22b8a92fb5ee Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents: 23998
diff changeset
1163 PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win);
22b8a92fb5ee Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents: 23998
diff changeset
1164
22b8a92fb5ee Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents: 23998
diff changeset
1165 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) {
31534
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 31517
diff changeset
1166 purple_prpl_send_attention(purple_conversation_get_gc(conv),
29638
22b8a92fb5ee Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents: 23998
diff changeset
1167 purple_conversation_get_name(conv), 0);
22b8a92fb5ee Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents: 23998
diff changeset
1168 }
22b8a92fb5ee Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents: 23998
diff changeset
1169 }
22b8a92fb5ee Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents: 23998
diff changeset
1170
22b8a92fb5ee Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents: 23998
diff changeset
1171 static void
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1172 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
1173 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1174 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1175 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1176
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1177 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
1178
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1179 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
1180 purple_conversation_get_name(conv), NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1181 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1182
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1183 static void
17776
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1184 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
1185 {
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1186 PidginWindow *win = data;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1187 PidginConversation *gtkconv;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1188 GtkIMHtmlToolbar *toolbar;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1189
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1190 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
1191 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar);
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1192
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1193 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
1194 !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
1195 }
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1196
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1197 static void
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1198 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
1199 {
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1200 PidginWindow *win = data;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1201 PidginConversation *gtkconv;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1202 GtkIMHtmlToolbar *toolbar;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1203
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1204 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
1205 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar);
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1206
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1207 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
1208 !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
1209 }
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1210
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1211
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1212 static void
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1213 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
1214 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1215 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1216 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1217 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1218 const char *name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1219
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1220 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
1221 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1222 name = purple_conversation_get_name(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1223
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1224 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
1225 PurpleBuddy *b;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1226
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1227 b = purple_find_buddy(account, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1228 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
1229 pidgin_dialogs_alias_buddy(b);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1230 } 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
1231 PurpleChat *c;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1232
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1233 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
1234 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
1235 pidgin_dialogs_alias_chat(c);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1236 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1237 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1238
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1239 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1240 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
1241 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1242 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1243 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1244
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1245 conv = pidgin_conv_window_get_active_conversation(win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1246
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1247 info_cb(NULL, PIDGIN_CONVERSATION(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1248 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1249
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1250 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1251 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
1252 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1253 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1254 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1255
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1256 conv = pidgin_conv_window_get_active_conversation(win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1257
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1258 invite_cb(NULL, PIDGIN_CONVERSATION(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1259 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1260
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1261 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1262 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
1263 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1264 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1265 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1266
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1267 conv = pidgin_conv_window_get_active_conversation(win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1268
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1269 block_cb(NULL, PIDGIN_CONVERSATION(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1270 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1271
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1272 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
1273 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
1274 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1275 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1276 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
1277
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1278 conv = pidgin_conv_window_get_active_conversation(win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1279
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1280 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
1281 }
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
1282
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
1283 static void
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1284 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
1285 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1286 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1287 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1288
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1289 conv = pidgin_conv_window_get_active_conversation(win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1290
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1291 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
1292 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1293
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
1294 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
1295 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
1296 {
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1297 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
1298 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
1299 }
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1300
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1301 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
1302 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
1303 {
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1304 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
1305
19556
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
1306 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
1307 "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
1308
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1309 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
1310 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
1311 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
1312 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
1313 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
1314 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
1315 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
1316 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
1317 }
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
1318 #if 0
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
1319 /* 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
1320 purple_conversation_set_ui_ops(conv, NULL);
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
1321 #else
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
1322 pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv);
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
1323 pidgin_conv_window_add_gtkconv(hidden_convwin, gtkconv);
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
1324 #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
1325 }
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
1326 }
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
1327
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
1328 static void
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1329 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
1330 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1331 PidginWindow *win = data;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1332
30016
97005a2e99d7 Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents: 29750
diff changeset
1333 close_conv_cb(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
1334 }
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 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1337 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
1338 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1339 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1340 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1341 gboolean logging;
22009
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1342 PurpleBlistNode *node;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1343
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1344 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
1345
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1346 if (conv == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1347 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1348
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1349 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
1350
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1351 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
1352 return;
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25362
diff changeset
1353
22009
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1354 node = get_conversation_blist_node(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1355
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1356 if (logging)
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 /* 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
1359 purple_conversation_set_logging(conv, TRUE);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1360
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1361 purple_conversation_write(conv, NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1362 _("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
1363 conv->logs ? (PURPLE_MESSAGE_SYSTEM) :
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1364 (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
1365 time(NULL));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1366 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1367 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1368 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1369 purple_conversation_write(conv, NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1370 _("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
1371 conv->logs ? (PURPLE_MESSAGE_SYSTEM) :
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1372 (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
1373 time(NULL));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1375 /* 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
1376 purple_conversation_set_logging(conv, FALSE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1377 }
22009
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1378
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1379 /* Save the setting IFF it's different than the pref. */
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1380 switch (conv->type)
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1381 {
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1382 case PURPLE_CONV_TYPE_IM:
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1383 if (logging == purple_prefs_get_bool("/purple/logging/log_ims"))
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1384 purple_blist_node_remove_setting(node, "enable-logging");
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1385 else
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1386 purple_blist_node_set_bool(node, "enable-logging", logging);
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1387 break;
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1388
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1389 case PURPLE_CONV_TYPE_CHAT:
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1390 if (logging == purple_prefs_get_bool("/purple/logging/log_chats"))
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1391 purple_blist_node_remove_setting(node, "enable-logging");
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1392 else
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1393 purple_blist_node_set_bool(node, "enable-logging", logging);
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1394 break;
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1395
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1396 default:
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1397 break;
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1398 }
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_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
1403 {
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
1404 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
1405 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
1406 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1407
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1408 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1409 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
1410 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1411 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1412 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1413 PidginConversation *gtkconv;
19980
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
1414 PurpleBlistNode *node;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1415
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1416 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
1417
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1418 if (!conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1419 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1420
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1421 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1422
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1423 gtkconv->make_sound =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1424 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
1425 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
1426 if (node)
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
1427 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
1428 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1429
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1430 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1431 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
1432 {
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
1433 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
1434 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
1435 }
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 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1438 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
1439 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1440 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1441 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1442 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1443 PurplePluginProtocolInfo *prpl_info = NULL;
23359
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1444 gchar *real_who = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1445
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1446 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1447 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1448
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1449 gc = purple_account_get_connection(account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1450 g_return_if_fail(gc != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1451
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1452 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
1453
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1454 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
1455 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
1456 purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), who);
23359
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1457
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1458 if(!who && !real_who)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1459 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1460
23359
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1461 pidgin_dialogs_im_with_user(account, real_who ? real_who : who);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1462
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1463 g_free(real_who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1464 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1465
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
1466 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
1467
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1468 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1469 ignore_cb(GtkWidget *w, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1470 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1471 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1472 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
1473 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
1474
3974d12a56ec Fix ignore in chats when using right-click on a nick in the conversation
Stu Tomlinson <stu@nosnilmot.com>
parents: 16273
diff changeset
1475 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
1476 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
1477
3974d12a56ec Fix ignore in chats when using right-click on a nick in the conversation
Stu Tomlinson <stu@nosnilmot.com>
parents: 16273
diff changeset
1478 if (name == NULL)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1479 return;
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 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
1482 purple_conv_chat_unignore(chat, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1483 else
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1484 purple_conv_chat_ignore(chat, name);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1485
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
1486 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
1487 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1488
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1489 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1490 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
1491 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1492 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
1493
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1494 chat_do_im(gtkconv, who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1495 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1496
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1497 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1498 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
1499 {
23359
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1500 PurplePluginProtocolInfo *prpl_info;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1501 PurpleConversation *conv = gtkconv->active_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1502 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
1503 PurpleConnection *gc = purple_conversation_get_gc(conv);
23359
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1504 gchar *real_who = NULL;
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1505
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1506 g_return_if_fail(gc != NULL);
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1507
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1508 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1509
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1510 if (prpl_info && prpl_info->get_cb_real_name)
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1511 real_who = prpl_info->get_cb_real_name(gc,
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1512 purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), who);
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1513
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1514 serv_send_file(gc, real_who ? real_who : who, NULL);
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1515 g_free(real_who);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1516 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1517
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1518 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1519 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
1520 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1521 char *who;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1522
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1523 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
1524
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1525 chat_do_info(gtkconv, who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1526 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1527
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1528 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1529 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
1530 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1531 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1532 PurplePluginProtocolInfo *prpl_info = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1533 PurpleConnection *gc;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1534 char *who;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1535
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1536 gc = purple_conversation_get_gc(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1537 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
1538
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1539 if (gc != NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1540 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
1541
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1542 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1543 * 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
1544 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1545
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1546 if (prpl_info->get_cb_away != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1547 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1548 prpl_info->get_cb_away(gc,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1549 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
1550 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1551 }
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1554 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1555 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
1556 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1557 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1558 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1559 PurpleBuddy *b;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1560 char *name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1561
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1562 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1563 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
1564 b = purple_find_buddy(account, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1565
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1566 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
1567 pidgin_dialogs_remove_buddy(b);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1568 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
1569 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
1570
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1571 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
1572 }
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 static GtkTextMark *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1575 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
1576 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1577 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
1578 char *tmp = g_strconcat("user:", who, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1579 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
1580
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1581 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1582 return mark;
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 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1586 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
1587 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1588 GtkTextMark *mark;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1589 const char *who;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1590
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1591 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
1592 mark = get_mark_for_user(gtkconv, who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1593
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1594 if (mark != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1595 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
1596 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1597 g_return_if_reached();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1598 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1599
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1600 static GtkWidget *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1601 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
1602 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1603 static GtkWidget *menu = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1604 PurplePluginProtocolInfo *prpl_info = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1605 PurpleConvChat *chat = PURPLE_CONV_CHAT(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1606 gboolean is_me = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1607 GtkWidget *button;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1608 PurpleBuddy *buddy = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1609
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1610 if (gc != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1611 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
1612
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1613 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1614 * 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
1615 * thus freeing-up the memory it occupied.
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 if (menu)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1618 gtk_widget_destroy(menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1619
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1620 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
1621 is_me = TRUE;
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 menu = gtk_menu_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1624
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1625 if (!is_me) {
15560
442128853bdb toolbar/menu icons. reduce the imhtmltoolbar spacing. more gaimstock pruning
Sean Egan <seanegan@gmail.com>
parents: 15557
diff changeset
1626 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
1627 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
1628
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1629 if (gc == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1630 gtk_widget_set_sensitive(button, FALSE);
23359
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1631 else
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1632 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1633
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 if (prpl_info && prpl_info->send_file)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1636 {
23359
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1637 gboolean can_receive_file = TRUE;
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1638
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
1639 button = pidgin_new_item_from_stock(menu, _("Send File"),
16839
d6ccf170148e New Send File icon
Hylke Bons <hylkebons@gmail.com>
parents: 16809
diff changeset
1640 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
1641 PIDGIN_CONVERSATION(conv), 0, 0, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1642
23359
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1643 if (gc == NULL || prpl_info == NULL)
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1644 can_receive_file = FALSE;
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1645 else {
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1646 gchar *real_who = NULL;
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1647 if (prpl_info->get_cb_real_name)
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1648 real_who = prpl_info->get_cb_real_name(gc,
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1649 purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), who);
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1650 if (!(!prpl_info->can_receive_file || prpl_info->can_receive_file(gc, real_who ? real_who : who)))
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1651 can_receive_file = FALSE;
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1652 g_free(real_who);
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1653 }
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1654
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1655 if (!can_receive_file)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1656 gtk_widget_set_sensitive(button, FALSE);
23359
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1657 else
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1658 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1659 }
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
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1662 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
1663 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
1664 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
1665 else
15509
23ca11f8a8c4 stock to pidgin
Sean Egan <seanegan@gmail.com>
parents: 15508
diff changeset
1666 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
1667 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
1668
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1669 if (gc == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1670 gtk_widget_set_sensitive(button, FALSE);
23359
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1671 else
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1672 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1673 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1674
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1675 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
1676 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
1677 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
1678
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1679 if (gc == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1680 gtk_widget_set_sensitive(button, FALSE);
23359
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1681 else
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1682 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1683 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1684
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1685 if (prpl_info && prpl_info->get_cb_away) {
15509
23ca11f8a8c4 stock to pidgin
Sean Egan <seanegan@gmail.com>
parents: 15508
diff changeset
1686 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
1687 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
1688
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1689 if (gc == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1690 gtk_widget_set_sensitive(button, FALSE);
23359
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1691 else
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1692 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1693 }
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 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
1696 if ((buddy = purple_find_buddy(conv->account, who)) != NULL)
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
1697 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
1698 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
1699 else
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
1700 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
1701 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
1702
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1703 if (gc == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1704 gtk_widget_set_sensitive(button, FALSE);
23359
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1705 else
398f84dd4041 Use the chat user's real username (if available) for more things (e.g.) file
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23283
diff changeset
1706 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1707 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1708
27417
e0c0b4eb36ed More Title Casing.
Etan Reisner <pidgin@unreliablesource.net>
parents: 27094
diff changeset
1709 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
1710 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
1711 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
1712 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
1713 gtk_widget_set_sensitive(button, FALSE);
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 if (buddy != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1716 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1717 if (purple_account_is_connected(conv->account))
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1718 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
1719 (PurpleBlistNode *)buddy);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1720 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
1721 gtk_widget_show_all(menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1722 }
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 return menu;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1725 }
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1728 static gint
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1729 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
1730 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1731 PurpleConversation *conv = gtkconv->active_conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1732 PidginChatPane *gtkchat;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1733 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1734 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1735 GtkTreeSelection *sel;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1736 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1737 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1738 GtkWidget *menu;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1739 gchar *who;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1740
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1741 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1742 gtkchat = gtkconv->u.chat;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1743 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1744 gc = account->gc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1745
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1746 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
1747
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1748 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
1749 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
1750 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1751
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1752 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
1753 menu = create_chat_menu (conv, who, gc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1754 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
1755 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
1756 0, GDK_CURRENT_TIME);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1757 g_free(who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1758
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1759 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1760 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1761
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1762
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1763 static gint
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1764 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
1765 PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1766 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1767 PurpleConversation *conv = gtkconv->active_conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1768 PidginChatPane *gtkchat;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1769 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1770 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1771 GtkTreePath *path;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1772 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1773 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1774 GtkTreeViewColumn *column;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1775 gchar *who;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1776 int x, y;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1777
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1778 gtkchat = gtkconv->u.chat;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1779 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1780 gc = account->gc;
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 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
1783
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1784 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
1785 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
1786
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1787 if (path == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1788 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1789
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1790 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
1791 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
1792 gtk_tree_view_set_cursor(GTK_TREE_VIEW(gtkchat->list),
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25362
diff changeset
1793 path, NULL, FALSE);
18311
6fa1bbf6b0a9 Allow the userlist to get focus, to allow keyboard navigation of it.
Sean Egan <seanegan@gmail.com>
parents: 18306
diff changeset
1794 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
1795
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1796 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
1797 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
1798
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1799 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
1800 chat_do_im(gtkconv, who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1801 } 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
1802 /* Move to user's anchor */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1803 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
1804
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1805 if(mark != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1806 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
1807 } 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
1808 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
1809 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
1810 event->button, event->time);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1811 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1812
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1813 g_free(who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1814 gtk_tree_path_free(path);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1815
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1816 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1817 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1818
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1819 static void
22626
2e16a86883c7 Patch from fmoo to make double-clicking or hitting enter on a chatroom user
Will Thompson <will.thompson@collabora.co.uk>
parents: 22613
diff changeset
1820 activate_list_cb(GtkTreeView *list, GtkTreePath *path, GtkTreeViewColumn *column, PidginConversation *gtkconv)
2e16a86883c7 Patch from fmoo to make double-clicking or hitting enter on a chatroom user
Will Thompson <will.thompson@collabora.co.uk>
parents: 22613
diff changeset
1821 {
2e16a86883c7 Patch from fmoo to make double-clicking or hitting enter on a chatroom user
Will Thompson <will.thompson@collabora.co.uk>
parents: 22613
diff changeset
1822 GtkTreeIter iter;
2e16a86883c7 Patch from fmoo to make double-clicking or hitting enter on a chatroom user
Will Thompson <will.thompson@collabora.co.uk>
parents: 22613
diff changeset
1823 GtkTreeModel *model;
2e16a86883c7 Patch from fmoo to make double-clicking or hitting enter on a chatroom user
Will Thompson <will.thompson@collabora.co.uk>
parents: 22613
diff changeset
1824 gchar *who;
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25362
diff changeset
1825
22626
2e16a86883c7 Patch from fmoo to make double-clicking or hitting enter on a chatroom user
Will Thompson <will.thompson@collabora.co.uk>
parents: 22613
diff changeset
1826 model = gtk_tree_view_get_model(GTK_TREE_VIEW(list));
2e16a86883c7 Patch from fmoo to make double-clicking or hitting enter on a chatroom user
Will Thompson <will.thompson@collabora.co.uk>
parents: 22613
diff changeset
1827
2e16a86883c7 Patch from fmoo to make double-clicking or hitting enter on a chatroom user
Will Thompson <will.thompson@collabora.co.uk>
parents: 22613
diff changeset
1828 gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, path);
2e16a86883c7 Patch from fmoo to make double-clicking or hitting enter on a chatroom user
Will Thompson <will.thompson@collabora.co.uk>
parents: 22613
diff changeset
1829 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &who, -1);
2e16a86883c7 Patch from fmoo to make double-clicking or hitting enter on a chatroom user
Will Thompson <will.thompson@collabora.co.uk>
parents: 22613
diff changeset
1830 chat_do_im(gtkconv, who);
2e16a86883c7 Patch from fmoo to make double-clicking or hitting enter on a chatroom user
Will Thompson <will.thompson@collabora.co.uk>
parents: 22613
diff changeset
1831
2e16a86883c7 Patch from fmoo to make double-clicking or hitting enter on a chatroom user
Will Thompson <will.thompson@collabora.co.uk>
parents: 22613
diff changeset
1832 g_free(who);
2e16a86883c7 Patch from fmoo to make double-clicking or hitting enter on a chatroom user
Will Thompson <will.thompson@collabora.co.uk>
parents: 22613
diff changeset
1833 }
2e16a86883c7 Patch from fmoo to make double-clicking or hitting enter on a chatroom user
Will Thompson <will.thompson@collabora.co.uk>
parents: 22613
diff changeset
1834
2e16a86883c7 Patch from fmoo to make double-clicking or hitting enter on a chatroom user
Will Thompson <will.thompson@collabora.co.uk>
parents: 22613
diff changeset
1835 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1836 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
1837 {
17141
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1838 PidginConversation *next_gtkconv = NULL, *most_active = NULL;
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1839 PidginUnseenState unseen_state = PIDGIN_UNSEEN_NONE;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1840 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1841 int initial, i, total, diff;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1842
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1843 win = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1844 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
1845 gtkconv->tab_cont);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1846 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
1847 /* 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
1848 * 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
1849 * positive number.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1850 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1851 diff = (forward ? 1 : -1) + total;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1852
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1853 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
1854 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
1855 if (next_gtkconv->unseen_state > unseen_state) {
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1856 most_active = next_gtkconv;
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1857 unseen_state = most_active->unseen_state;
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1858 if(PIDGIN_UNSEEN_NICK == unseen_state) /* highest possible state */
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1859 break;
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1860 }
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1861 }
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1862
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1863 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
1864 i = (i + diff) % total;
17141
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1865 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
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 && most_active != gtkconv)
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1869 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
1870 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1871
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1872 static gboolean
24268
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1873 gtkconv_cycle_focus(PidginConversation *gtkconv, GtkDirectionType dir)
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1874 {
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1875 PurpleConversation *conv = gtkconv->active_conv;
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1876 gboolean chat = purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT;
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1877 GtkWidget *next = NULL;
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1878 struct {
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1879 GtkWidget *from;
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1880 GtkWidget *to;
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1881 } transitions[] = {
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1882 {gtkconv->entry, gtkconv->imhtml},
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1883 {gtkconv->imhtml, chat ? gtkconv->u.chat->list : gtkconv->entry},
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1884 {chat ? gtkconv->u.chat->list : NULL, gtkconv->entry},
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1885 {NULL, NULL}
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1886 }, *ptr;
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1887
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1888 for (ptr = transitions; !next && ptr->from; ptr++) {
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1889 GtkWidget *from, *to;
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1890 if (dir == GTK_DIR_TAB_FORWARD) {
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1891 from = ptr->from;
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1892 to = ptr->to;
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1893 } else {
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1894 from = ptr->to;
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1895 to = ptr->from;
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1896 }
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1897 if (gtk_widget_is_focus(from))
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1898 next = to;
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1899 }
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1900
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1901 if (next)
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1902 gtk_widget_grab_focus(next);
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1903 return !!next;
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1904 }
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1905
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1906 static gboolean
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1907 conv_keypress_common(PidginConversation *gtkconv, GdkEventKey *event)
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 PidginWindow *win;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1910 int curconv;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1911
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1912 win = gtkconv->win;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1913 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
1914
25103
33ceb2b708cf Close the tooltip window on a keypress event. Fixes #8150.
Kosta Arvanitis <karvanitis@hotmail.com>
parents: 24537
diff changeset
1915 /* clear any tooltips */
33ceb2b708cf Close the tooltip window on a keypress event. Fixes #8150.
Kosta Arvanitis <karvanitis@hotmail.com>
parents: 24537
diff changeset
1916 pidgin_tooltip_destroy();
33ceb2b708cf Close the tooltip window on a keypress event. Fixes #8150.
Kosta Arvanitis <karvanitis@hotmail.com>
parents: 24537
diff changeset
1917
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1918 /* If CTRL was held down... */
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1919 if (event->state & GDK_CONTROL_MASK) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1920 switch (event->keyval) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1921 case GDK_Page_Down:
31516
f48808788b53 Allow the use of the numeric keypad's Page Up and Page Down keys in the
rflegel@gmail.com
parents: 30993
diff changeset
1922 case GDK_KP_Page_Down:
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1923 case ']':
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1924 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
1925 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
1926 else
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1927 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
1928 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1929 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1930
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1931 case GDK_Page_Up:
31517
b44ee1fe06f5 Small typo fix. Refs #13127.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31516
diff changeset
1932 case GDK_KP_Page_Up:
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1933 case '[':
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1934 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
1935 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
1936 else
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1937 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
1938 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1939 break;
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 case GDK_Tab:
22835
f28047b68678 Patch from QuLogic to fix tab-navigation in the statusbox. And a few
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22818
diff changeset
1942 case GDK_KP_Tab:
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1943 case GDK_ISO_Left_Tab:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1944 if (event->state & GDK_SHIFT_MASK) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1945 move_to_next_unread_tab(gtkconv, FALSE);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1946 } else {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1947 move_to_next_unread_tab(gtkconv, TRUE);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1948 }
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 break;
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 case GDK_comma:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1954 gtk_notebook_reorder_child(GTK_NOTEBOOK(win->notebook),
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1955 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
1956 curconv - 1);
20190
da6a1320d3e1 applied changes from f4700a52b60d8473e9671ceabfec7772211fe424
Richard Laager <rlaager@wiktel.com>
parents: 20183
diff changeset
1957 return TRUE;
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1958 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1959
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1960 case GDK_period:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1961 gtk_notebook_reorder_child(GTK_NOTEBOOK(win->notebook),
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1962 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
1963 (curconv + 1) % gtk_notebook_get_n_pages(GTK_NOTEBOOK(win->notebook)));
20190
da6a1320d3e1 applied changes from f4700a52b60d8473e9671ceabfec7772211fe424
Richard Laager <rlaager@wiktel.com>
parents: 20183
diff changeset
1964 return TRUE;
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1965 break;
24268
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1966 case GDK_F6:
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1967 if (gtkconv_cycle_focus(gtkconv, event->state & GDK_SHIFT_MASK ? GTK_DIR_TAB_BACKWARD : GTK_DIR_TAB_FORWARD))
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1968 return TRUE;
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1969 break;
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1970 } /* End of switch */
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1971 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1972
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1973 /* If ALT (or whatever) was held down... */
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1974 else if (event->state & GDK_MOD1_MASK)
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1975 {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1976 if (event->keyval > '0' && event->keyval <= '9')
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1977 {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1978 guint switchto = event->keyval - '1';
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1979 if (switchto < pidgin_conv_window_get_gtkconv_count(win))
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1980 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
1981
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1982 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1983 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1984 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1985
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1986 /* If neither CTRL nor ALT were held down... */
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1987 else
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1988 {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1989 switch (event->keyval) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1990 case GDK_F2:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1991 if (gtk_widget_is_focus(GTK_WIDGET(win->notebook))) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1992 infopane_entry_activate(gtkconv);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1993 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1994 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1995 break;
24268
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1996 case GDK_F6:
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1997 if (gtkconv_cycle_focus(gtkconv, event->state & GDK_SHIFT_MASK ? GTK_DIR_TAB_BACKWARD : GTK_DIR_TAB_FORWARD))
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1998 return TRUE;
1335376ba33f Allow focusing conversation history and the userlist focusable via
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24267
diff changeset
1999 break;
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2000 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2001 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2002 return FALSE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2003 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2004
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2005 static gboolean
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2006 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
2007 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2008 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2009 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2010
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2011 gtkconv = (PidginConversation *)data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2012 conv = gtkconv->active_conv;
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25362
diff changeset
2013
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2014 if (conv_keypress_common(gtkconv, event))
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2015 return TRUE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2016
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2017 /* If CTRL was held down... */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2018 if (event->state & GDK_CONTROL_MASK) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2019 switch (event->keyval) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2020 case GDK_Up:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2021 if (!gtkconv->send_history)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2022 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2023
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
2024 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
2025 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
2026
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2027 if (!gtkconv->send_history->prev) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2028 GtkTextIter start, end;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2029
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2030 g_free(gtkconv->send_history->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2031
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2032 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
2033 &start);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2034 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
2035
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2036 gtkconv->send_history->data =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2037 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
2038 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2039
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2040 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
2041 GObject *object;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2042 GtkTextIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2043 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
2044
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2045 gtkconv->send_history = gtkconv->send_history->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2046
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2047 /* 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
2048 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
2049 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
2050 NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2051 /* Clear the formatting. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2052 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
2053 /* Unblock the signal. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2054 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
2055 NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2056 g_object_unref(object);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2057
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2058 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2059 gtk_imhtml_append_text_with_images(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2060 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
2061 0, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2062 /* 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
2063 * cursor gets picked up. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2064 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
2065 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
2066 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2067
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2068 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2069 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2070
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2071 case GDK_Down:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2072 if (!gtkconv->send_history)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2073 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2074
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
2075 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
2076 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
2077
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2078 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
2079 GObject *object;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2080 GtkTextIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2081 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
2082
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2083 gtkconv->send_history = gtkconv->send_history->prev;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2084
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2085 /* 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
2086 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
2087 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
2088 NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2089 /* Clear the formatting. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2090 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
2091 /* Unblock the signal. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2092 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
2093 NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2094 g_object_unref(object);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2095
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2096 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2097 gtk_imhtml_append_text_with_images(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2098 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
2099 0, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2100 /* 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
2101 * cursor gets picked up. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2102 if (*(char *)gtkconv->send_history->data) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2103 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
2104 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
2105 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2106 /* Restore the default formatting */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2107 default_formatize(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2108 }
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 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2112 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2113 } /* End of switch */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2114 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2115
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2116 /* If ALT (or whatever) was held down... */
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2117 else if (event->state & GDK_MOD1_MASK) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2118
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2119 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2120
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2121 /* If neither CTRL nor ALT were held down... */
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2122 else {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2123 switch (event->keyval) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2124 case GDK_Tab:
22835
f28047b68678 Patch from QuLogic to fix tab-navigation in the statusbox. And a few
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22818
diff changeset
2125 case GDK_KP_Tab:
f28047b68678 Patch from QuLogic to fix tab-navigation in the statusbox. And a few
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22818
diff changeset
2126 case GDK_ISO_Left_Tab:
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2127 if (gtkconv->entry != entry)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2128 break;
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2129 return tab_complete(conv);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2130 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2131
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2132 case GDK_Page_Up:
31516
f48808788b53 Allow the use of the numeric keypad's Page Up and Page Down keys in the
rflegel@gmail.com
parents: 30993
diff changeset
2133 case GDK_KP_Page_Up:
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2134 gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml));
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2135 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2136 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2137
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2138 case GDK_Page_Down:
31516
f48808788b53 Allow the use of the numeric keypad's Page Up and Page Down keys in the
rflegel@gmail.com
parents: 30993
diff changeset
2139 case GDK_KP_Page_Down:
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2140 gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml));
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2141 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2142 break;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2143
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2144 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2145 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2146 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2147 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2148
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2149 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2150 * NOTE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2151 * 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
2152 * 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
2153 * 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
2154 * 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
2155 * 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
2156 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2157 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2158 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
2159 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2160 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
2161 /* Right single click */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2162 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
2163
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2164 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2165 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2166
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2167 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2168 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2169
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 * 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
2172 * 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
2173 * 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
2174 * 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
2175 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2176 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2177 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
2178 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2179 PidginConversation *gtkconv = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2180
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2181 /* 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
2182 if ((event->state & GDK_CONTROL_MASK) ||
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2183 (event->keyval == GDK_F6) ||
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2184 (event->keyval == GDK_F10) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2185 (event->keyval == GDK_Shift_L) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2186 (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
2187 (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
2188 (event->keyval == GDK_Control_R) ||
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2189 (event->keyval == GDK_Escape) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2190 (event->keyval == GDK_Up) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2191 (event->keyval == GDK_Down) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2192 (event->keyval == GDK_Left) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2193 (event->keyval == GDK_Right) ||
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2194 (event->keyval == GDK_Page_Up) ||
31516
f48808788b53 Allow the use of the numeric keypad's Page Up and Page Down keys in the
rflegel@gmail.com
parents: 30993
diff changeset
2195 (event->keyval == GDK_KP_Page_Up) ||
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2196 (event->keyval == GDK_Page_Down) ||
31516
f48808788b53 Allow the use of the numeric keypad's Page Up and Page Down keys in the
rflegel@gmail.com
parents: 30993
diff changeset
2197 (event->keyval == GDK_KP_Page_Down) ||
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2198 (event->keyval == GDK_Home) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2199 (event->keyval == GDK_End) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2200 (event->keyval == GDK_Tab) ||
22835
f28047b68678 Patch from QuLogic to fix tab-navigation in the statusbox. And a few
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22818
diff changeset
2201 (event->keyval == GDK_KP_Tab) ||
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2202 (event->keyval == GDK_ISO_Left_Tab))
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2203 {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2204 if (event->type == GDK_KEY_PRESS)
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2205 return conv_keypress_common(gtkconv, event);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2206 return FALSE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2207 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2208
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2209 if (event->type == GDK_KEY_RELEASE)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2210 gtk_widget_grab_focus(gtkconv->entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2211
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2212 gtk_widget_event(gtkconv->entry, (GdkEvent *)event);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2213
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2214 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2215 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2216
17846
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
2217 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
2218 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
2219
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2220 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2221 pidgin_conv_switch_active_conversation(PurpleConversation *conv)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2222 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2223 PidginConversation *gtkconv;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2224 PurpleConversation *old_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2225 GtkIMHtml *entry;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2226 const char *protocol_name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2227
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2228 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2229
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2230 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2231 old_conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2232
29643
bb9f7ba4f299 Added active conversation on GtkIMHtmlToolbar
Marcus Lundblad <ml@update.uu.se>
parents: 29638
diff changeset
2233 purple_debug_info("gtkconv", "setting active conversation on toolbar %p\n",
bb9f7ba4f299 Added active conversation on GtkIMHtmlToolbar
Marcus Lundblad <ml@update.uu.se>
parents: 29638
diff changeset
2234 conv);
31534
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 31517
diff changeset
2235 gtk_imhtmltoolbar_switch_active_conversation(GTK_IMHTMLTOOLBAR(gtkconv->toolbar),
29643
bb9f7ba4f299 Added active conversation on GtkIMHtmlToolbar
Marcus Lundblad <ml@update.uu.se>
parents: 29638
diff changeset
2236 conv);
29742
422889fb57e0 propagate from branch 'im.pidgin.pidgin' (head 9028ac0daaa1f7e565726fa39aca22ce7d3ecc49)
Paul Aurich <paul@darkrain42.org>
parents: 29307 29741
diff changeset
2237
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2238 if (old_conv == conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2239 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2240
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2241 purple_conversation_close_logs(old_conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2242 gtkconv->active_conv = conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2243
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2244 purple_conversation_set_logging(conv,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2245 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
2246
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2247 entry = GTK_IMHTML(gtkconv->entry);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2248 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
2249 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
2250 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
2251
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2252 if (!(conv->features & PURPLE_CONNECTION_HTML))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2253 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
2254 else if (conv->features & PURPLE_CONNECTION_FORMATTING_WBFO &&
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2255 !(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
2256 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2257 /* 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
2258 * 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
2259 * 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
2260 * 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
2261 * 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
2262
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2263 gboolean bold;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2264 gboolean italic;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2265 gboolean underline;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2266 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
2267 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
2268 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
2269 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
2270 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
2271 gboolean bold2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2272 gboolean italic2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2273 gboolean underline2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2274
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2275 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
2276
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2277 /* Clear existing formatting */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2278 gtk_imhtml_clear_formatting(entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2279
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2280 /* Apply saved formatting to the whole buffer. */
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_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
2283
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2284 if (bold != bold2)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2285 gtk_imhtml_toggle_bold(entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2286
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2287 if (italic != italic2)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2288 gtk_imhtml_toggle_italic(entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2289
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2290 if (underline != underline2)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2291 gtk_imhtml_toggle_underline(entry);
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 gtk_imhtml_toggle_fontface(entry, fontface);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2294
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2295 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
2296 gtk_imhtml_font_set_size(entry, fontsize);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2297
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2298 gtk_imhtml_toggle_forecolor(entry, forecolor);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2299
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2300 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
2301 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2302 gtk_imhtml_toggle_backcolor(entry, backcolor);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2303 gtk_imhtml_toggle_background(entry, background);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2304 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2305
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2306 g_free(fontface);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2307 g_free(forecolor);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2308 g_free(backcolor);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2309 g_free(background);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2310 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2311 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2312 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2313 /* 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
2314 * 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
2315 * 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
2316 * 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
2317 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
2318 (conv->features & PURPLE_CONNECTION_FORMATTING_WBFO));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2319 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2320
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2321 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
2322
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2323 gray_stuff_out(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2324 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
2325 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
2326 regenerate_options_items(gtkconv->win);
15374
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 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
2329 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
2330 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2331
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2332 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2333 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
2334 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2335 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
2336 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
2337 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2338
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2339 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
2340 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2341
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2342 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
2343 pidgin_conv_switch_active_conversation(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2344 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2345
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2346 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2347 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2348 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
2349 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2350 PidginConversation *gtkconv = (PidginConversation *)user_data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2351
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2352 g_return_if_fail(gtkconv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2353
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
2354 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
2355 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2356
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2357 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
2358 gtk_text_iter_is_end(position)));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2359 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2360
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2361 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2362 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
2363 GtkTextIter *end_pos, gpointer user_data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2364 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2365 PidginConversation *gtkconv = (PidginConversation *)user_data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2366 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2367 PurpleConvIm *im;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2368
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2369 g_return_if_fail(gtkconv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2370
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2371 conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2372
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
2373 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
2374 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2375
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2376 im = PURPLE_CONV_IM(conv);
15374
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 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
2379
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2380 /* 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
2381 purple_conv_im_stop_send_typed_timeout(im);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2382
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2383 serv_send_typing(purple_conversation_get_gc(conv),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2384 purple_conversation_get_name(conv),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2385 PURPLE_NOT_TYPING);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2386 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2387 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2388 /* 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
2389 got_typing_keypress(gtkconv, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2390 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2391 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2392
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2393 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2394 * A bunch of buddy icon functions
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2395 **************************************************************************/
15724
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2396
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2397 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
2398 {
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2399 GList *l = NULL;
17397
012aaa301a30 Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17392
diff changeset
2400 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
2401 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
2402 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
2403 l = g_hash_table_lookup(prpl_lists, prplname);
15724
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2404 if (l)
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2405 return l;
17397
012aaa301a30 Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17392
diff changeset
2406
012aaa301a30 Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17392
diff changeset
2407 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
2408 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
2409 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
2410
012aaa301a30 Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17392
diff changeset
2411 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
2412 return l;
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2413 }
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2414
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2415 static GList *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2416 pidgin_conv_get_tab_icons(PurpleConversation *conv)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2417 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2418 PurpleAccount *account = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2419 const char *name = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2420
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2421 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
2422
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2423 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2424 name = purple_conversation_get_name(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2425
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2426 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
2427 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
2428
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2429 /* Use the buddy icon, if possible */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2430 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
2431 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
2432 if (b != NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2433 PurplePresence *p;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2434 p = purple_buddy_get_presence(b);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2435 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
2436 return away_list;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2437 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
2438 return busy_list;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2439 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
2440 return xa_list;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2441 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
2442 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
2443 else
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2444 return available_list;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2445 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2446 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2447
15724
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2448 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
2449 }
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2450
26721
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2451 static const char *
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2452 pidgin_conv_get_icon_stock(PurpleConversation *conv)
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2453 {
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2454 PurpleAccount *account = NULL;
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2455 const char *stock = NULL;
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2456
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2457 g_return_val_if_fail(conv != NULL, NULL);
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2458
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2459 account = purple_conversation_get_account(conv);
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2460 g_return_val_if_fail(account != NULL, NULL);
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2461
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2462 /* Use the buddy icon, if possible */
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2463 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) {
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2464 const char *name = NULL;
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2465 PurpleBuddy *b;
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2466 name = purple_conversation_get_name(conv);
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2467 b = purple_find_buddy(account, name);
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2468 if (b != NULL) {
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2469 PurplePresence *p = purple_buddy_get_presence(b);
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2470 PurpleStatus *active = purple_presence_get_active_status(p);
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2471 PurpleStatusType *type = purple_status_get_type(active);
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2472 PurpleStatusPrimitive prim = purple_status_type_get_primitive(type);
26725
0011cd06990a Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26721
diff changeset
2473 stock = pidgin_stock_id_from_status_primitive(prim);
26721
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2474 } else {
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2475 stock = PIDGIN_STOCK_STATUS_PERSON;
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2476 }
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2477 } else {
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2478 stock = PIDGIN_STOCK_STATUS_CHAT;
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2479 }
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2480
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2481 return stock;
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2482 }
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2483
19899
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2484 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
2485 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
2486 {
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2487 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
2488 const char *name = NULL;
26721
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2489 const char *stock = NULL;
19899
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2490 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
2491 PurpleBlistUiOps *ops = purple_blist_get_ui_ops();
26721
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2492 GtkIconSize size;
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2493
19899
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2494 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
2495
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2496 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
2497 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
2498
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2499 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
2500 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
2501
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2502 /* 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
2503 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
2504 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
2505 if (b != NULL) {
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2506 /* 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
2507 * 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
2508 * 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
2509 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
2510 ops->update(NULL, (PurpleBlistNode*)b);
26721
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2511 }
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2512 }
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2513
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2514 stock = pidgin_conv_get_icon_stock(conv);
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2515 size = gtk_icon_size_from_name(icon_size);
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2516 status = gtk_widget_render_icon (parent, stock, size, "GtkWidget");
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2517 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
2518 }
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2519
19899
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2520 GdkPixbuf *
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2521 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
2522 {
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2523 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
2524 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
2525 }
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2526
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2527
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2528 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2529 update_tab_icon(PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2530 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2531 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2532 PidginWindow *win;
16315
ee4ce3c4186f Fix #248 (Control shouldn't steal focus from scrollback)
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16286
diff changeset
2533 GList *l;
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2534 GdkPixbuf *emblem = NULL;
26727
dbe2731f0a35 Use stock-id in the conversation tab-labels and tab-menus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26725
diff changeset
2535 const char *status = NULL;
26721
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
2536 const char *infopane_status = NULL;
15374
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 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2539
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2540 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2541 win = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2542 if (conv != gtkconv->active_conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2543 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2544
26727
dbe2731f0a35 Use stock-id in the conversation tab-labels and tab-menus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26725
diff changeset
2545 status = infopane_status = pidgin_conv_get_icon_stock(conv);
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2546
21991
cca516eb7610 Show the emblem in conversation infopane correctly for chats.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21951
diff changeset
2547 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) {
cca516eb7610 Show the emblem in conversation infopane correctly for chats.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21951
diff changeset
2548 PurpleBuddy *b = purple_find_buddy(conv->account, conv->name);
cca516eb7610 Show the emblem in conversation infopane correctly for chats.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21951
diff changeset
2549 if (b)
cca516eb7610 Show the emblem in conversation infopane correctly for chats.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21951
diff changeset
2550 emblem = pidgin_blist_get_emblem((PurpleBlistNode*)b);
cca516eb7610 Show the emblem in conversation infopane correctly for chats.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21951
diff changeset
2551 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2552
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2553 g_return_if_fail(status != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2554
26727
dbe2731f0a35 Use stock-id in the conversation tab-labels and tab-menus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26725
diff changeset
2555 g_object_set(G_OBJECT(gtkconv->icon), "stock", status, NULL);
dbe2731f0a35 Use stock-id in the conversation tab-labels and tab-menus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26725
diff changeset
2556 g_object_set(G_OBJECT(gtkconv->menu_icon), "stock", status, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2557
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25362
diff changeset
2558 gtk_list_store_set(GTK_LIST_STORE(gtkconv->infopane_model),
18214
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2559 &(gtkconv->infopane_iter),
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2560 CONV_ICON_COLUMN, infopane_status, -1);
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2561
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25362
diff changeset
2562 gtk_list_store_set(GTK_LIST_STORE(gtkconv->infopane_model),
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2563 &(gtkconv->infopane_iter),
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2564 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
2565 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
2566 g_object_unref(emblem);
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2567
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
2568 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
2569 emblem = pidgin_create_prpl_icon(gtkconv->active_conv->account, PIDGIN_PRPL_ICON_SMALL);
22725
fe546f9e3cbf Use the correct name for a preference. This will correctly update the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22678
diff changeset
2570 } else {
fe546f9e3cbf Use the correct name for a preference. This will correctly update the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22678
diff changeset
2571 emblem = NULL;
fe546f9e3cbf Use the correct name for a preference. This will correctly update the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22678
diff changeset
2572 }
fe546f9e3cbf Use the correct name for a preference. This will correctly update the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22678
diff changeset
2573
fe546f9e3cbf Use the correct name for a preference. This will correctly update the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22678
diff changeset
2574 gtk_list_store_set(GTK_LIST_STORE(gtkconv->infopane_model),
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
2575 &(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
2576 CONV_PROTOCOL_ICON_COLUMN, emblem, -1);
22725
fe546f9e3cbf Use the correct name for a preference. This will correctly update the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22678
diff changeset
2577 if (emblem)
fe546f9e3cbf Use the correct name for a preference. This will correctly update the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22678
diff changeset
2578 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
2579
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
2580 /* XXX seanegan Why do I have to do this? */
22725
fe546f9e3cbf Use the correct name for a preference. This will correctly update the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22678
diff changeset
2581 gtk_widget_queue_resize(gtkconv->infopane);
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
2582 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
2583
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2584 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
2585 (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
2586 gtkconv->u.im->anim == NULL))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2587 {
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2588 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
2589
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2590 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
2591 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2592 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2593
22465
77b6ff5bdb07 This should fix the 1px bug. If someone still sees this bug after this change, please let me know.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22437
diff changeset
2594 #if 0
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2595 /* 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
2596 * 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
2597 * 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
2598 * 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
2599 * gets set back to FALSE
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2600 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2601 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
2602 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2603 PidginConversation *gtkconv = (PidginConversation *)data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2604 gtkconv->auto_resize = FALSE;
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 }
22465
77b6ff5bdb07 This should fix the 1px bug. If someone still sees this bug after this change, please let me know.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22437
diff changeset
2607 #endif
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2608
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2609 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2610 redraw_icon(gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2611 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2612 PidginConversation *gtkconv = (PidginConversation *)data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2613 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2614 PurpleAccount *account;
15374
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 GdkPixbuf *buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2617 GdkPixbuf *scale;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2618 gint delay;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2619 int scale_width, scale_height;
22733
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2620 int size;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2621
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2622 gtkconv = PIDGIN_CONVERSATION(conv);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2623 account = purple_conversation_get_account(conv);
16604
598b66923c81 hopefully fix 236
Nathan Walp <nwalp@pidgin.im>
parents: 16577
diff changeset
2624
30863
351d07aefb09 Kill off many dead assignments and any useless remaining variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30579
diff changeset
2625 if (!(account && account->gc)) {
16604
598b66923c81 hopefully fix 236
Nathan Walp <nwalp@pidgin.im>
parents: 16577
diff changeset
2626 gtkconv->u.im->icon_timer = 0;
598b66923c81 hopefully fix 236
Nathan Walp <nwalp@pidgin.im>
parents: 16577
diff changeset
2627 return FALSE;
598b66923c81 hopefully fix 236
Nathan Walp <nwalp@pidgin.im>
parents: 16577
diff changeset
2628 }
15374
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 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
2631 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
2632
22733
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2633 scale_width = gdk_pixbuf_get_width(buf);
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2634 scale_height = gdk_pixbuf_get_height(buf);
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2635
26986
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
2636 gtk_widget_get_size_request(gtkconv->u.im->icon_container, NULL, &size);
22733
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2637 size = MIN(size, MIN(scale_width, scale_height));
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2638 size = CLAMP(size, BUDDYICON_SIZE_MIN, BUDDYICON_SIZE_MAX);
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2639
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2640 if (scale_width == scale_height) {
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2641 scale_width = scale_height = size;
18214
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2642 } else if (scale_height > scale_width) {
22733
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2643 scale_width = size * scale_width / scale_height;
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2644 scale_height = size;
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2645 } else {
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2646 scale_height = size * scale_height / scale_width;
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2647 scale_width = size;
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2648 }
18214
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2649
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2650 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
2651 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
2652 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
2653 pidgin_gdk_pixbuf_make_round(scale);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2654
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2655 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
2656 g_object_unref(G_OBJECT(scale));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2657 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
2658
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2659 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
2660
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2661 if (delay < 100)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2662 delay = 100;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2663
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2664 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
2665
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2666 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2667 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2668
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2669 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2670 start_anim(GtkObject *obj, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2671 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2672 int delay;
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 if (gtkconv->u.im->anim == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2675 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2676
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2677 if (gtkconv->u.im->icon_timer != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2678 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2679
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2680 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
2681 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2682
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2683 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
2684
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2685 if (delay < 100)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2686 delay = 100;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2687
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2688 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
2689 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2690
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2691 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2692 remove_icon(GtkWidget *widget, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2693 {
26986
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
2694 GList *children;
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
2695 GtkWidget *event;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2696 PurpleConversation *conv = gtkconv->active_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2697
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2698 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2699
26986
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
2700 gtk_widget_set_size_request(gtkconv->u.im->icon_container, -1, BUDDYICON_SIZE_MIN);
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
2701 children = gtk_container_get_children(GTK_CONTAINER(gtkconv->u.im->icon_container));
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
2702 if (children) {
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
2703 /* We know there's only one child here. It'd be nice to shortcut to the
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
2704 event box, but we can't change the PidginConversation until 3.0 */
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
2705 event = (GtkWidget *)children->data;
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
2706 gtk_container_remove(GTK_CONTAINER(gtkconv->u.im->icon_container), event);
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
2707 g_list_free(children);
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
2708 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2709
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2710 if (gtkconv->u.im->anim != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2711 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
2712
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2713 if (gtkconv->u.im->icon_timer != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2714 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
2715
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2716 if (gtkconv->u.im->iter != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2717 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
2718
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2719 gtkconv->u.im->icon_timer = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2720 gtkconv->u.im->icon = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2721 gtkconv->u.im->anim = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2722 gtkconv->u.im->iter = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2723 gtkconv->u.im->show_icon = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2724 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2725
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2726 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2727 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
2728 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2729 PidginConversation *gtkconv = (PidginConversation *)user_data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2730 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2731 PurpleBuddyIcon *icon;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2732 const void *data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2733 size_t len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2734
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2735 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
2736 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
2737
24513
cff5d920b87f Replace some old code using fwrite() with a call to
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24323
diff changeset
2738 if ((len <= 0) || (data == NULL) || !purple_util_write_data_to_file_absolute(filename, data, len)) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2739 purple_notify_error(gtkconv, NULL, _("Unable to save icon file to disk."), NULL);
24513
cff5d920b87f Replace some old code using fwrite() with a call to
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24323
diff changeset
2740 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2741 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2742
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2743 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2744 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
2745 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2746 if (filename) {
23122
f6c57e6e8a89 Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <pidgin@unreliablesource.net>
parents: 23119
diff changeset
2747 const gchar *name;
f6c57e6e8a89 Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <pidgin@unreliablesource.net>
parents: 23119
diff changeset
2748 PurpleBuddy *buddy;
f6c57e6e8a89 Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <pidgin@unreliablesource.net>
parents: 23119
diff changeset
2749 PurpleContact *contact;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2750 PidginConversation *gtkconv = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2751 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2752 PurpleAccount *account = purple_conversation_get_account(conv);
23122
f6c57e6e8a89 Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <pidgin@unreliablesource.net>
parents: 23119
diff changeset
2753
f6c57e6e8a89 Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <pidgin@unreliablesource.net>
parents: 23119
diff changeset
2754 name = purple_conversation_get_name(conv);
23123
0ca259d5f928 Compile and de-warn.
Etan Reisner <pidgin@unreliablesource.net>
parents: 23122
diff changeset
2755 buddy = purple_find_buddy(account, name);
23122
f6c57e6e8a89 Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <pidgin@unreliablesource.net>
parents: 23119
diff changeset
2756 if (!buddy) {
f6c57e6e8a89 Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <pidgin@unreliablesource.net>
parents: 23119
diff changeset
2757 purple_debug_info("custom-icon", "You can only set custom icons for people on your buddylist.\n");
f6c57e6e8a89 Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <pidgin@unreliablesource.net>
parents: 23119
diff changeset
2758 return;
f6c57e6e8a89 Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <pidgin@unreliablesource.net>
parents: 23119
diff changeset
2759 }
f6c57e6e8a89 Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <pidgin@unreliablesource.net>
parents: 23119
diff changeset
2760 contact = purple_buddy_get_contact(buddy);
f6c57e6e8a89 Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <pidgin@unreliablesource.net>
parents: 23119
diff changeset
2761
f6c57e6e8a89 Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <pidgin@unreliablesource.net>
parents: 23119
diff changeset
2762 purple_buddy_icons_node_set_custom_icon_from_file((PurpleBlistNode*)contact, filename);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2763 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2764 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2765
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2766 static void
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2767 set_custom_icon_cb(GtkWidget *widget, PidginConversation *gtkconv)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2768 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2769 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
2770 custom_icon_sel_cb, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2771 gtk_widget_show_all(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2772 }
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 static void
22733
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2775 change_size_cb(GtkWidget *widget, PidginConversation *gtkconv)
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2776 {
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2777 int size = 0;
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2778 PurpleConversation *conv = gtkconv->active_conv;
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2779 GSList *buddies;
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2780
26986
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
2781 gtk_widget_get_size_request(gtkconv->u.im->icon_container, NULL, &size);
22733
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2782
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2783 if (size == BUDDYICON_SIZE_MAX) {
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2784 size = BUDDYICON_SIZE_MIN;
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2785 } else {
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2786 size = BUDDYICON_SIZE_MAX;
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2787 }
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2788
26986
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
2789 gtk_widget_set_size_request(gtkconv->u.im->icon_container, -1, size);
22733
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2790 pidgin_conv_update_buddy_icon(conv);
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2791
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2792 buddies = purple_find_buddies(purple_conversation_get_account(conv),
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2793 purple_conversation_get_name(conv));
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2794 for (; buddies; buddies = g_slist_delete_link(buddies, buddies)) {
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2795 PurpleBuddy *buddy = buddies->data;
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2796 PurpleContact *contact = purple_buddy_get_contact(buddy);
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2797 purple_blist_node_set_int((PurpleBlistNode*)contact, "pidgin-infopane-iconsize", size);
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2798 }
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2799 }
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2800
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2801 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2802 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
2803 {
23122
f6c57e6e8a89 Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <pidgin@unreliablesource.net>
parents: 23119
diff changeset
2804 const gchar *name;
f6c57e6e8a89 Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <pidgin@unreliablesource.net>
parents: 23119
diff changeset
2805 PurpleBuddy *buddy;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2806 PurpleAccount *account;
23122
f6c57e6e8a89 Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <pidgin@unreliablesource.net>
parents: 23119
diff changeset
2807 PurpleContact *contact;
f6c57e6e8a89 Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <pidgin@unreliablesource.net>
parents: 23119
diff changeset
2808 PurpleConversation *conv = gtkconv->active_conv;
f6c57e6e8a89 Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <pidgin@unreliablesource.net>
parents: 23119
diff changeset
2809
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2810 account = purple_conversation_get_account(conv);
23123
0ca259d5f928 Compile and de-warn.
Etan Reisner <pidgin@unreliablesource.net>
parents: 23122
diff changeset
2811 name = purple_conversation_get_name(conv);
0ca259d5f928 Compile and de-warn.
Etan Reisner <pidgin@unreliablesource.net>
parents: 23122
diff changeset
2812 buddy = purple_find_buddy(account, name);
23122
f6c57e6e8a89 Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <pidgin@unreliablesource.net>
parents: 23119
diff changeset
2813 if (!buddy) {
f6c57e6e8a89 Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <pidgin@unreliablesource.net>
parents: 23119
diff changeset
2814 return;
f6c57e6e8a89 Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <pidgin@unreliablesource.net>
parents: 23119
diff changeset
2815 }
f6c57e6e8a89 Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <pidgin@unreliablesource.net>
parents: 23119
diff changeset
2816 contact = purple_buddy_get_contact(buddy);
f6c57e6e8a89 Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <pidgin@unreliablesource.net>
parents: 23119
diff changeset
2817
f6c57e6e8a89 Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <pidgin@unreliablesource.net>
parents: 23119
diff changeset
2818 purple_buddy_icons_node_set_custom_icon_from_file((PurpleBlistNode*)contact, NULL);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2819 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2820
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2821 static void
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2822 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
2823 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2824 PurpleConversation *conv = gtkconv->active_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2825 const gchar *ext;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2826 gchar *buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2827
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2828 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2829
16375
391a79778f89 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@wiktel.com>
parents: 16373
diff changeset
2830 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
2831
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2832 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
2833
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2834 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
2835 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
2836 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
2837 gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2838
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2839 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2840 }
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 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2843 stop_anim(GtkObject *obj, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2844 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2845 if (gtkconv->u.im->icon_timer != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2846 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
2847
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2848 gtkconv->u.im->icon_timer = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2849 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2850
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2851
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2852 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2853 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
2854 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2855 gtkconv->u.im->animate =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2856 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
2857
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2858 if (gtkconv->u.im->animate)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2859 start_anim(NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2860 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2861 stop_anim(NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2862 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2863
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2864 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2865 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
2866 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2867 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
2868 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
2869 PurpleBuddy *buddy;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2870
22733
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2871 if (e->button == 1 && e->type == GDK_BUTTON_PRESS) {
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2872 change_size_cb(NULL, gtkconv);
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2873 return TRUE;
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2874 }
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2875
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2876 if (e->button != 3 || e->type != GDK_BUTTON_PRESS) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2877 return FALSE;
22733
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2878 }
15374
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 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2881 * 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
2882 * thus freeing-up the memory it occupied.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2883 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2884 if (menu != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2885 gtk_widget_destroy(menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2886
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2887 menu = gtk_menu_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2888
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2889 if (gtkconv->u.im->anim &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2890 !(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
2891 {
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
2892 pidgin_new_check_item(menu, _("Animate"),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2893 G_CALLBACK(toggle_icon_animate_cb), gtkconv,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2894 gtkconv->u.im->icon_timer);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2895 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2896
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
2897 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
2898 gtkconv, 0, 0, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2899
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
2900 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
2901 G_CALLBACK(icon_menu_save_cb), gtkconv,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2902 0, 0, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2903
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
2904 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
2905 G_CALLBACK(set_custom_icon_cb), gtkconv,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2906 0, 0, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2907
22733
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2908 pidgin_new_item_from_stock(menu, _("Change Size"), NULL,
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2909 G_CALLBACK(change_size_cb), gtkconv,
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2910 0, 0, NULL);
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2911
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2912 /* 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
2913 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
2914 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
2915 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
2916 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
2917 {
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
2918 PurpleContact *contact = purple_buddy_get_contact(buddy);
23123
0ca259d5f928 Compile and de-warn.
Etan Reisner <pidgin@unreliablesource.net>
parents: 23122
diff changeset
2919 if (contact && purple_buddy_icons_node_has_custom_icon((PurpleBlistNode*)contact))
16381
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
2920 {
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
2921 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
2922 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
2923 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
2924 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2925 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2926
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2927 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
2928
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2929 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2930 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2931
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2932 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2933 * 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
2934 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2935 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2936 pidgin_conv_present_conversation(PurpleConversation *conv)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2937 {
22326
63f102c210ad This should fix the issue with persistent conversations getting closed all unexpected like.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22287
diff changeset
2938 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
2939 GdkModifierType state;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2940
22326
63f102c210ad This should fix the issue with persistent conversations getting closed all unexpected like.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22287
diff changeset
2941 pidgin_conv_attach_to_conversation(conv);
63f102c210ad This should fix the issue with persistent conversations getting closed all unexpected like.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22287
diff changeset
2942 gtkconv = PIDGIN_CONVERSATION(conv);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
2943
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
2944 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
2945 /* 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
2946 * 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
2947 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
2948 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
2949 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
2950 }
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 GList *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2953 pidgin_conversations_find_unseen_list(PurpleConversationType type,
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
2954 PidginUnseenState min_state,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2955 gboolean hidden_only,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2956 guint max_count)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2957 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
2958 GList *l;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2959 GList *r = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2960 guint c = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2961
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2962 if (type == PURPLE_CONV_TYPE_IM) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2963 l = purple_get_ims();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2964 } else if (type == PURPLE_CONV_TYPE_CHAT) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2965 l = purple_get_chats();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2966 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2967 l = purple_get_conversations();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2968 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2969
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2970 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
2971 PurpleConversation *conv = (PurpleConversation*)l->data;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2972 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2973
19417
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
2974 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
2975 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2976
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2977 if (gtkconv->unseen_state >= min_state
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2978 && (!hidden_only ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2979 (hidden_only && gtkconv->win == hidden_convwin))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2980
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2981 r = g_list_prepend(r, conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2982 c++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2983 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2984 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2985
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2986 return r;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2987 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2988
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2989 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2990 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
2991 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2992 g_return_if_fail(conv != NULL);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
2993 pidgin_conv_present_conversation(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2994 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2995
19584
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2996 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
2997 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
2998 {
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2999 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
3000 /* 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
3001 * '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
3002 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
3003 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
3004 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
3005 }
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
3006 }
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
3007
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3008 guint
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3009 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
3010 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3011 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3012 guint ret=0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3013
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3014 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
3015 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
3016
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3017 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
3018 PurpleConversation *conv = (PurpleConversation*)l->data;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3019 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3020
26727
dbe2731f0a35 Use stock-id in the conversation tab-labels and tab-menus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26725
diff changeset
3021 GtkWidget *icon = gtk_image_new_from_stock(pidgin_conv_get_icon_stock(conv),
dbe2731f0a35 Use stock-id in the conversation tab-labels and tab-menus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26725
diff changeset
3022 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_MICROSCOPIC));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3023 GtkWidget *item;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3024 gchar *text = g_strdup_printf("%s (%d)",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3025 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
3026 gtkconv->unseen_count);
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 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
3029 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
3030 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
3031 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
3032 g_free(text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3033 ret++;
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
19584
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
3036 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
3037 /* 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
3038 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
3039 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
3040
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
3041 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
3042
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
3043 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
3044 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
3045 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
3046 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
3047 }
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
3048
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3049 return ret;
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
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3052 PidginWindow *
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
3053 pidgin_conv_get_window(PidginConversation *gtkconv)
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 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
3056 return gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3057 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3058
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3059 static GtkItemFactoryEntry menu_items[] =
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 /* Conversation menu */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3062 { N_("/_Conversation"), NULL, NULL, 0, "<Branch>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3063
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3064 { 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
3065 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW },
28364
cf533027c3be Don't add an accelerator to "Join a Chat" in a conversation window.
Paul Aurich <paul@darkrain42.org>
parents: 28349
diff changeset
3066 { N_("/Conversation/Join a _Chat..."), NULL, menu_join_chat_cb,
28318
38f09799476a Didn't realize I hadn't pushed this before the string freeze so we get to do
Etan Reisner <pidgin@unreliablesource.net>
parents: 27603
diff changeset
3067 0, "<StockItem>", PIDGIN_STOCK_CHAT },
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3068
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3069 { "/Conversation/sep0", NULL, NULL, 0, "<Separator>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3070
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3071 { 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
3072 "<StockItem>", GTK_STOCK_FIND },
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
3073 { 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
3074 { 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
3075 "<StockItem>", GTK_STOCK_SAVE_AS },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3076 { N_("/Conversation/Clea_r Scrollback"), "<CTL>L", menu_clear_cb, 0, "<StockItem>", GTK_STOCK_CLEAR },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3077
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3078 { "/Conversation/sep1", NULL, NULL, 0, "<Separator>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3079
25654
cbe97caec684 Use USE_VV instead of USE_FARSIGHT.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25651
diff changeset
3080 #ifdef USE_VV
25662
28ab41065172 Create a proper media menu with options for audio, video, and
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25660
diff changeset
3081 { N_("/Conversation/M_edia"), NULL, NULL, 0, "<Branch>", NULL },
28ab41065172 Create a proper media menu with options for audio, video, and
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25660
diff changeset
3082
26144
2091094745d9 Simplify the media menu callbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
3083 { N_("/Conversation/Media/_Audio Call"), NULL, menu_initiate_media_call_cb, 0,
25662
28ab41065172 Create a proper media menu with options for audio, video, and
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25660
diff changeset
3084 "<StockItem>", PIDGIN_STOCK_TOOLBAR_AUDIO_CALL },
26144
2091094745d9 Simplify the media menu callbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
3085 { N_("/Conversation/Media/_Video Call"), NULL, menu_initiate_media_call_cb, 1,
25662
28ab41065172 Create a proper media menu with options for audio, video, and
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25660
diff changeset
3086 "<StockItem>", PIDGIN_STOCK_TOOLBAR_VIDEO_CALL },
26144
2091094745d9 Simplify the media menu callbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
3087 { N_("/Conversation/Media/Audio\\/Video _Call"), NULL, menu_initiate_media_call_cb, 2,
25684
cd3bb7a73925 New media icons. Thanks, hbons.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25671
diff changeset
3088 "<StockItem>", PIDGIN_STOCK_TOOLBAR_VIDEO_CALL },
25637
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25636
diff changeset
3089 #endif
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25636
diff changeset
3090
16839
d6ccf170148e New Send File icon
Hylke Bons <hylkebons@gmail.com>
parents: 16809
diff changeset
3091 { N_("/Conversation/Se_nd File..."), NULL, menu_send_file_cb, 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_SEND_FILE },
29638
22b8a92fb5ee Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents: 23998
diff changeset
3092 { N_("/Conversation/Get _Attention"), NULL, menu_get_attention_cb, 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION },
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3093 { 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
3094 0, "<Item>", NULL },
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3095 { 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
3096 "<StockItem>", PIDGIN_STOCK_TOOLBAR_USER_INFO },
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3097 { 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
3098 "<Item>", NULL },
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3099 { 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
3100
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3101 { "/Conversation/sep2", NULL, NULL, 0, "<Separator>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3102
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3103 { 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
3104 "<Item>", NULL },
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3105 { 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
3106 "<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
3107 { 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
3108 "<StockItem>", PIDGIN_STOCK_TOOLBAR_UNBLOCK },
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3109 { 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
3110 "<StockItem>", GTK_STOCK_ADD },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3111 { 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
3112 "<StockItem>", GTK_STOCK_REMOVE },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3113
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3114 { "/Conversation/sep3", NULL, NULL, 0, "<Separator>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3115
17776
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3116 { 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
3117 "<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
3118 { 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
3119 "<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
3120
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3121 { "/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
3122
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3123
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3124 { 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
3125 "<StockItem>", GTK_STOCK_CLOSE },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3126
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3127 /* Options */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3128 { N_("/_Options"), NULL, NULL, 0, "<Branch>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3129 { 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
3130 { 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
3131 { "/Options/sep0", NULL, NULL, 0, "<Separator>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3132 { N_("/Options/Show Formatting _Toolbars"), NULL, menu_toolbar_cb, 0, "<CheckItem>", NULL },
22784
fdf60a5c2f66 Kill the default F2 keybinding for show timestamps, it only confuses people
Stu Tomlinson <stu@nosnilmot.com>
parents: 22781
diff changeset
3133 { N_("/Options/Show Ti_mestamps"), NULL, menu_timestamps_cb, 0, "<CheckItem>", NULL },
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3134 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3135
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3136 static const int menu_item_count =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3137 sizeof(menu_items) / sizeof(*menu_items);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3138
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3139 static const char *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3140 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
3141 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3142 return _(path);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3143 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3144
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3145 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3146 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
3147 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3148 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3149 PidginWindow *win = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3150 const char *method = value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3151
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3152 if (!strcmp(method, "none"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3153 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3154 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
3155 FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3156 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
3157 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3158 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3159 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3160 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
3161
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3162 if (gtkconv != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3163 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
3164 gtkconv->make_sound);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3165 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
3166
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3167 }
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
18658
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3170 /* 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
3171 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
3172 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
3173 {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3174 GList *list;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3175 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
3176 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
3177 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
3178 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
3179 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
3180
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3181 conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3182
17846
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3183 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
3184 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
3185
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3186 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
3187 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
3188 }
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3189
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3190 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
3191 GHashTable *components;
23184
89713caa9ade Try to get a hashtable created by the prpl first before joining a chat
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23169
diff changeset
3192 PurpleAccount *account = purple_conversation_get_account(conv);
89713caa9ade Try to get a hashtable created by the prpl first before joining a chat
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23169
diff changeset
3193 PurplePlugin *prpl = purple_find_prpl(purple_account_get_protocol_id(account));
89713caa9ade Try to get a hashtable created by the prpl first before joining a chat
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23169
diff changeset
3194 PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
23283
e965a497ddfb Don't try to retrieve the chat_info_defaults while signed off, it tends to
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23197
diff changeset
3195 if (purple_account_get_connection(account) != NULL &&
e965a497ddfb Don't try to retrieve the chat_info_defaults while signed off, it tends to
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23197
diff changeset
3196 PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, chat_info_defaults)) {
23184
89713caa9ade Try to get a hashtable created by the prpl first before joining a chat
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23169
diff changeset
3197 components = prpl_info->chat_info_defaults(purple_account_get_connection(account),
89713caa9ade Try to get a hashtable created by the prpl first before joining a chat
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23169
diff changeset
3198 purple_conversation_get_name(conv));
89713caa9ade Try to get a hashtable created by the prpl first before joining a chat
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23169
diff changeset
3199 } else {
89713caa9ade Try to get a hashtable created by the prpl first before joining a chat
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23169
diff changeset
3200 components = g_hash_table_new_full(g_str_hash, g_str_equal,
89713caa9ade Try to get a hashtable created by the prpl first before joining a chat
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23169
diff changeset
3201 g_free, g_free);
89713caa9ade Try to get a hashtable created by the prpl first before joining a chat
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23169
diff changeset
3202 g_hash_table_replace(components, g_strdup("channel"),
89713caa9ade Try to get a hashtable created by the prpl first before joining a chat
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23169
diff changeset
3203 g_strdup(purple_conversation_get_name(conv)));
89713caa9ade Try to get a hashtable created by the prpl first before joining a chat
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23169
diff changeset
3204 }
17846
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3205 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
3206 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
3207 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
3208 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
3209 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
3210 }
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3211 } 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
3212 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
3213 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
3214
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
3215 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
3216
17846
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3217 /* 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
3218 * 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
3219 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
3220 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
3221 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
3222 }
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3223
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3224 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
3225 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
3226 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
3227 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
3228 g_object_set_data_full(G_OBJECT(gtkconv->imhtml), "transient_buddy",
27583
2a19181b41fa Fix a crash relating to the actual freeing of the buddy list stuff.
Paul Aurich <paul@darkrain42.org>
parents: 27552
diff changeset
3229 buddy, (GDestroyNotify)purple_buddy_destroy);
17846
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3230 }
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3231 }
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3232 }
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3233
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
3234 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
3235 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
3236 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
3237 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
3238
18658
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3239 /* 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
3240 if (all) {
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
3241 if (buddy)
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
3242 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
3243 else if (chat) {
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
3244 /* XXX: */
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
3245 }
18658
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3246 } 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
3247 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
3248 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
3249 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
3250 }
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3251
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3252 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
3253 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
3254 } else {
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3255 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
3256 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
3257 }
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3258 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
3259 }
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3260
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3261 static void
28178
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3262 regenerate_media_items(PidginWindow *win)
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3263 {
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3264 #ifdef USE_VV
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3265 PurpleAccount *account;
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3266 PurpleConversation *conv;
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3267
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3268 conv = pidgin_conv_window_get_active_conversation(win);
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3269
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3270 if (conv == NULL) {
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3271 purple_debug_error("gtkconv", "couldn't get active conversation"
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3272 " when regenerating media items\n");
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3273 return;
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3274 }
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3275
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3276 account = purple_conversation_get_account(conv);
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3277
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3278 if (account == NULL) {
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3279 purple_debug_error("gtkconv", "couldn't get account when"
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3280 " regenerating media items\n");
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3281 return;
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3282 }
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3283
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3284 /*
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3285 * Check if account support voice and/or calls, and
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3286 * if the current buddy supports it.
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3287 */
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3288 if (account != NULL && purple_conversation_get_type(conv)
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3289 == PURPLE_CONV_TYPE_IM) {
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3290 PurpleMediaCaps caps =
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3291 purple_prpl_get_media_caps(account,
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3292 purple_conversation_get_name(conv));
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3293
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3294 gtk_widget_set_sensitive(win->audio_call,
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3295 caps & PURPLE_MEDIA_CAPS_AUDIO
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3296 ? TRUE : FALSE);
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3297 gtk_widget_set_sensitive(win->video_call,
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3298 caps & PURPLE_MEDIA_CAPS_VIDEO
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3299 ? TRUE : FALSE);
31534
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 31517
diff changeset
3300 gtk_widget_set_sensitive(win->audio_video_call,
28178
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3301 caps & PURPLE_MEDIA_CAPS_AUDIO_VIDEO
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3302 ? TRUE : FALSE);
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3303 } else if (purple_conversation_get_type(conv)
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3304 == PURPLE_CONV_TYPE_CHAT) {
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3305 /* for now, don't care about chats... */
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3306 gtk_widget_set_sensitive(win->audio_call, FALSE);
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3307 gtk_widget_set_sensitive(win->video_call, FALSE);
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3308 gtk_widget_set_sensitive(win->audio_video_call, FALSE);
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3309 } else {
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3310 gtk_widget_set_sensitive(win->audio_call, FALSE);
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3311 gtk_widget_set_sensitive(win->video_call, FALSE);
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3312 gtk_widget_set_sensitive(win->audio_video_call, FALSE);
31534
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 31517
diff changeset
3313 }
28178
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3314 #endif
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3315 }
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3316
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3317 static void
18658
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3318 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
3319 {
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3320 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
3321 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
3322 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
3323
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3324 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
3325 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
3326
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3327 /* Remove the previous entries */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3328 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
3329 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3330 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
3331 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
3332 gtk_widget_destroy(w);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3333 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3334
18658
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3335 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
3336 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3337 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
3338 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
3339 gtk_widget_set_sensitive(item, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3340 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3341
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3342 gtk_widget_show_all(menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3343 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3344
17392
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3345 static void
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3346 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
3347 {
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3348 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
3349 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
3350 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
3351 }
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3352
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3353 static void
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3354 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
3355 {
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3356 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
3357 GtkWidget *menu;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3358 GList *list;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3359 PidginConversation *gtkconv;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3360 PurpleConversation *conv;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3361 GtkWidget *item;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3362
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
3363 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
3364 return;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3365
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3366 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
3367 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
3368 return;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3369
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3370 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
3371 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
3372
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3373 /* 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
3374 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
3375 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
3376 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
3377 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
3378 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
3379 }
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3380
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3381 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
3382
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3383 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
3384 if (list) {
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3385 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
3386 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
3387 }
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3388
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3389 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
3390 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
3391 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
3392 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
3393 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
3394 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
3395 }
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3396 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
3397 }
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3398
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3399 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
3400 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3401 PidginWindow *win = data;
28178
f660386afa66 Check for media caps when the conversation menu is activated.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27603
diff changeset
3402 regenerate_media_items(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3403 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
3404 regenerate_plugins_items(win);
15374
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 /* 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
3407 * 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
3408 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
3409 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
3410 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3411
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3412 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3413 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
3414 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3415 /* 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
3416 * the 'Conversation' menu pops up. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3417 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
3418 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
3419 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
3420 G_CALLBACK(focus_out_from_menubar), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3421 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3422
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3423 static GtkWidget *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3424 setup_menubar(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3425 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3426 GtkAccelGroup *accel_group;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3427 const char *method;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3428 GtkWidget *menuitem;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3429
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3430 accel_group = gtk_accel_group_new ();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3431 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
3432 g_object_unref(accel_group);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3433
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3434 win->menu.item_factory =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3435 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
3436
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3437 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
3438 (GtkTranslateFunc)item_factory_translate_func,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3439 NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3440
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3441 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
3442 menu_items, win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3443 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
3444 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
3445
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3446 /* 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
3447 * 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
3448 * conversation is created. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3449 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
3450 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
3451
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3452 win->menu.menubar =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3453 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
3454
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3455 win->menu.view_log =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3456 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
3457 N_("/Conversation/View Log"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3458
25654
cbe97caec684 Use USE_VV instead of USE_FARSIGHT.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25651
diff changeset
3459 #ifdef USE_VV
26477
e1523f30bdb5 Move these variables to the end to not break ABI.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26434
diff changeset
3460 win->audio_call =
25662
28ab41065172 Create a proper media menu with options for audio, video, and
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25660
diff changeset
3461 gtk_item_factory_get_widget(win->menu.item_factory,
28ab41065172 Create a proper media menu with options for audio, video, and
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25660
diff changeset
3462 N_("/Conversation/Media/Audio Call"));
26477
e1523f30bdb5 Move these variables to the end to not break ABI.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26434
diff changeset
3463 win->video_call =
25637
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25636
diff changeset
3464 gtk_item_factory_get_widget(win->menu.item_factory,
25662
28ab41065172 Create a proper media menu with options for audio, video, and
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25660
diff changeset
3465 N_("/Conversation/Media/Video Call"));
26477
e1523f30bdb5 Move these variables to the end to not break ABI.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26434
diff changeset
3466 win->audio_video_call =
25662
28ab41065172 Create a proper media menu with options for audio, video, and
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25660
diff changeset
3467 gtk_item_factory_get_widget(win->menu.item_factory,
28ab41065172 Create a proper media menu with options for audio, video, and
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25660
diff changeset
3468 N_("/Conversation/Media/Audio\\/Video Call"));
25637
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25636
diff changeset
3469 #endif
31534
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 31517
diff changeset
3470
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3471 /* --- */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3472
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3473 win->menu.send_file =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3474 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
3475 N_("/Conversation/Send File..."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3476
29701
28880022598c Temporary workaround to not break ABI, to allow this in for 2.7.0
Marcus Lundblad <ml@update.uu.se>
parents: 29697
diff changeset
3477 g_object_set_data(G_OBJECT(win->window), "get_attention",
29638
22b8a92fb5ee Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents: 23998
diff changeset
3478 gtk_item_factory_get_widget(win->menu.item_factory,
29701
28880022598c Temporary workaround to not break ABI, to allow this in for 2.7.0
Marcus Lundblad <ml@update.uu.se>
parents: 29697
diff changeset
3479 N_("/Conversation/Get Attention")));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3480 win->menu.add_pounce =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3481 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
3482 N_("/Conversation/Add Buddy Pounce..."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3483
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3484 /* --- */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3485
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3486 win->menu.get_info =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3487 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
3488 N_("/Conversation/Get Info"));
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 win->menu.invite =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3491 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
3492 N_("/Conversation/Invite..."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3493
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3494 /* --- */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3495
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3496 win->menu.alias =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3497 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
3498 N_("/Conversation/Alias..."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3499
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3500 win->menu.block =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3501 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
3502 N_("/Conversation/Block..."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3503
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
3504 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
3505 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
3506 N_("/Conversation/Unblock..."));
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
3507
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3508 win->menu.add =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3509 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
3510 N_("/Conversation/Add..."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3511
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3512 win->menu.remove =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3513 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
3514 N_("/Conversation/Remove..."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3515
17776
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3516 /* --- */
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3517
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3518 win->menu.insert_link =
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3519 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
3520 N_("/Conversation/Insert Link..."));
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3521
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3522 win->menu.insert_image =
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3523 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
3524 N_("/Conversation/Insert Image..."));
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3525
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3526 /* --- */
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3527
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3528 win->menu.logging =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3529 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
3530 N_("/Options/Enable Logging"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3531 win->menu.sounds =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3532 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
3533 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
3534 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
3535 if (method != NULL && !strcmp(method, "none"))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3536 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3537 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
3538 FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3539 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
3540 }
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
3541 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
3542 sound_method_pref_changed_cb, win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3543
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3544 win->menu.show_formatting_toolbar =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3545 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
3546 N_("/Options/Show Formatting Toolbars"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3547 win->menu.show_timestamps =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3548 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
3549 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
3550 win->menu.show_icon = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3551
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3552 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
3553 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
3554 win->menu.tray);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3555 gtk_widget_show(win->menu.tray);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3556
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3557 gtk_widget_show(win->menu.menubar);
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 return win->menu.menubar;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3560 }
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3563 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3564 * Utility functions
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3567 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3568 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
3569 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3570 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3571 PurpleConvIm *im;
15374
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 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3574 * 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
3575 * send PURPLE_TYPED any time soon.
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3576 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3577
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3578 im = PURPLE_CONV_IM(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3579
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3580 purple_conv_im_stop_send_typed_timeout(im);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3581 purple_conv_im_start_send_typed_timeout(im);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3582
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3583 /* 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
3584 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
3585 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
3586 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3587 unsigned int timeout;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3588 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
3589 purple_conversation_get_name(conv),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3590 PURPLE_TYPING);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3591 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
3592 }
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
22037
7d5c6a456c36 ifdef out the typing menu tray icon, as the inline typing notifications do a better job notifying, I think
Sean Egan <seanegan@gmail.com>
parents: 22012
diff changeset
3595 #if 0
15725
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3596 static gboolean
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3597 typing_animation(gpointer data) {
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3598 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
3599 PidginWindow *gtkwin = gtkconv->win;
15725
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3600 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
3601
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
3602 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
3603 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
3604 }
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
3605
15725
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3606 switch (rand() % 5) {
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3607 case 0:
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3608 stock_id = PIDGIN_STOCK_ANIMATION_TYPING0;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3609 break;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3610 case 1:
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3611 stock_id = PIDGIN_STOCK_ANIMATION_TYPING1;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3612 break;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3613 case 2:
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3614 stock_id = PIDGIN_STOCK_ANIMATION_TYPING2;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3615 break;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3616 case 3:
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3617 stock_id = PIDGIN_STOCK_ANIMATION_TYPING3;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3618 break;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3619 case 4:
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3620 stock_id = PIDGIN_STOCK_ANIMATION_TYPING4;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3621 break;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3622 }
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3623 if (gtkwin->menu.typing_icon == NULL) {
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3624 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
3625 pidgin_menu_tray_append(PIDGIN_MENU_TRAY(gtkwin->menu.tray),
15725
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3626 gtkwin->menu.typing_icon,
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3627 _("User is typing..."));
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3628 } else {
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3629 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
3630 }
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3631 gtk_widget_show(gtkwin->menu.typing_icon);
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3632 return TRUE;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3633 }
22037
7d5c6a456c36 ifdef out the typing menu tray icon, as the inline typing notifications do a better job notifying, I think
Sean Egan <seanegan@gmail.com>
parents: 22012
diff changeset
3634 #endif
15725
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3635
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3636 static void
21875
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3637 update_typing_message(PidginConversation *gtkconv, const char *message)
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3638 {
22612
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
3639 GtkTextBuffer *buffer;
21875
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3640 GtkTextMark *stmark, *enmark;
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3641
22612
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
3642 if (g_object_get_data(G_OBJECT(gtkconv->imhtml), "disable-typing-notification"))
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
3643 return;
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
3644
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
3645 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml));
21875
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3646 stmark = gtk_text_buffer_get_mark(buffer, "typing-notification-start");
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3647 enmark = gtk_text_buffer_get_mark(buffer, "typing-notification-end");
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3648 if (stmark && enmark) {
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3649 GtkTextIter start, end;
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3650 gtk_text_buffer_get_iter_at_mark(buffer, &start, stmark);
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3651 gtk_text_buffer_get_iter_at_mark(buffer, &end, enmark);
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3652 gtk_text_buffer_delete_mark(buffer, stmark);
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3653 gtk_text_buffer_delete_mark(buffer, enmark);
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3654 gtk_text_buffer_delete(buffer, &start, &end);
22153
8f78d223d24e Fix the bug where removing the typing notification would cause the text to
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22104
diff changeset
3655 } else if (message && *message == '\n' && message[1] == ' ' && message[2] == '\0')
21897
a64a7bc69f42 Avoid jumpiness when typing notification in the conv. history is removed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21896
diff changeset
3656 message = NULL;
21875
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3657
22153
8f78d223d24e Fix the bug where removing the typing notification would cause the text to
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22104
diff changeset
3658 #ifdef RESERVE_LINE
8f78d223d24e Fix the bug where removing the typing notification would cause the text to
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22104
diff changeset
3659 if (!message)
8f78d223d24e Fix the bug where removing the typing notification would cause the text to
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22104
diff changeset
3660 message = "\n "; /* The blank space is required to avoid a GTK+/Pango bug */
8f78d223d24e Fix the bug where removing the typing notification would cause the text to
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22104
diff changeset
3661 #endif
8f78d223d24e Fix the bug where removing the typing notification would cause the text to
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22104
diff changeset
3662
21875
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3663 if (message) {
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3664 GtkTextIter iter;
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3665 gtk_text_buffer_get_end_iter(buffer, &iter);
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3666 gtk_text_buffer_create_mark(buffer, "typing-notification-start", &iter, TRUE);
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3667 gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, message, -1, "TYPING-NOTIFICATION", NULL);
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3668 gtk_text_buffer_get_end_iter(buffer, &iter);
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3669 gtk_text_buffer_create_mark(buffer, "typing-notification-end", &iter, TRUE);
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3670 }
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3671 }
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3672
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3673 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3674 update_typing_icon(PidginConversation *gtkconv)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3675 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3676 PurpleConvIm *im = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3677 PurpleConversation *conv = gtkconv->active_conv;
21875
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3678 char *message = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3679
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3680 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
3681 im = PURPLE_CONV_IM(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3682
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
3683 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
3684 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
3685
99bf55ec6ca4 Fix an invalid read that occurs because we were accessing IM data when the
Richard Laager <rlaager@wiktel.com>
parents: 16483
diff changeset
3686 if (purple_conv_im_get_typing_state(im) == PURPLE_NOT_TYPING) {
22153
8f78d223d24e Fix the bug where removing the typing notification would cause the text to
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22104
diff changeset
3687 #ifdef RESERVE_LINE
8f78d223d24e Fix the bug where removing the typing notification would cause the text to
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22104
diff changeset
3688 update_typing_message(gtkconv, NULL);
8f78d223d24e Fix the bug where removing the typing notification would cause the text to
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22104
diff changeset
3689 #else
8f78d223d24e Fix the bug where removing the typing notification would cause the text to
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22104
diff changeset
3690 update_typing_message(gtkconv, "\n ");
8f78d223d24e Fix the bug where removing the typing notification would cause the text to
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22104
diff changeset
3691 #endif
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3692 return;
15725
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3693 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3694
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3695 if (purple_conv_im_get_typing_state(im) == PURPLE_TYPING) {
21914
44abd56f3298 Use aliases in the typing notification.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21913
diff changeset
3696 message = g_strdup_printf(_("\n%s is typing..."), purple_conversation_get_title(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3697 } else {
22038
13d290879e0a shorted the 'typing then stopped' message
Sean Egan <seanegan@gmail.com>
parents: 22037
diff changeset
3698 message = g_strdup_printf(_("\n%s has stopped typing"), purple_conversation_get_title(conv));
13d290879e0a shorted the 'typing then stopped' message
Sean Egan <seanegan@gmail.com>
parents: 22037
diff changeset
3699 }
13d290879e0a shorted the 'typing then stopped' message
Sean Egan <seanegan@gmail.com>
parents: 22037
diff changeset
3700
21875
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3701 update_typing_message(gtkconv, message);
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3702 g_free(message);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3703 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3704
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3705 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3706 update_send_to_selection(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3707 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3708 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3709 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3710 GtkWidget *menu;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3711 GList *child;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3712 PurpleBuddy *b;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3713
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3714 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
3715
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3716 if (conv == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3717 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3718
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3719 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3720
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3721 if (account == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3722 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3723
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3724 if (win->menu.send_to == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3725 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3726
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3727 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
3728 return FALSE;
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 gtk_widget_show(win->menu.send_to);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3732
18658
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3733 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
3734
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3735 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
3736 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
3737 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
3738
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3739 GtkWidget *item = child->data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3740 PurpleBuddy *item_buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3741 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
3742 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
3743 "purple_buddy_name");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3744 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
3745
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3746 if (b == item_buddy) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3747 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
3748 g_list_free(child);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3749 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3750 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3751 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3752
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3753 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3754 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3755
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3756 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3757 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
3758 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3759 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
3760 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3761 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3762
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3763 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3764 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
3765 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3766 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
3767 return FALSE;
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 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3771 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
3772 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3773 GtkWidget *box;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3774 GtkWidget *label;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3775 GtkWidget *image;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3776 GtkWidget *menuitem;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3777 GdkPixbuf *pixbuf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3778 gchar *text;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3779
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3780 /* Create a pixmap for the protocol icon. */
15542
a1e0b153fc30 prpl icons in Send To menu
Sean Egan <seanegan@gmail.com>
parents: 15534
diff changeset
3781 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
3782
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3783 /* Now convert it to GtkImage */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3784 if (pixbuf == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3785 image = gtk_image_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3786 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3787 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3788 image = gtk_image_new_from_pixbuf(pixbuf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3789 g_object_unref(G_OBJECT(pixbuf));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3790 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3791
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3792 gtk_size_group_add_widget(sg, image);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3793
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3794 /* Make our menu item */
29503
7525698499e3 Move this to im.pidgin.pidgin.next.minor too so im.pidgin.pidgin will compile.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29502
diff changeset
3795 text = g_strdup_printf("%s (%s)", name, purple_account_get_name_for_display(account));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3796 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
3797 g_free(text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3798 *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
3799
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3800 /* 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
3801 box = gtk_hbox_new(FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3802
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3803 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
3804 g_object_ref(label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3805 gtk_container_remove(GTK_CONTAINER(menuitem), label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3806
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3807 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
3808 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
3809
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3810 if (buddy != NULL &&
29051
39a48c780bcb pidgin: Change the 'disabled' look in the Send To menu to apply to all offline buddies in a contact.
Paul Aurich <paul@darkrain42.org>
parents: 28960
diff changeset
3811 !purple_presence_is_online(purple_buddy_get_presence(buddy)))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3812 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3813 gtk_widget_set_sensitive(label, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3814
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3815 /* 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
3816 * 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
3817 * 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
3818 * (insensitive style) text.*/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3819 g_signal_connect(menuitem, "enter-notify-event",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3820 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
3821 g_signal_connect(menuitem, "leave-notify-event",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3822 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
3823 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3824
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3825 g_object_unref(label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3826
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3827 gtk_container_add(GTK_CONTAINER(menuitem), box);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3828
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3829 gtk_widget_show(label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3830 gtk_widget_show(image);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3831 gtk_widget_show(box);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3832
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3833 /* Set our data and callbacks. */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3834 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
3835 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
3836
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3837 g_signal_connect(G_OBJECT(menuitem), "activate",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3838 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
3839
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3840 gtk_widget_show(menuitem);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3841 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
3842 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3843
22732
35c7cd1e4771 Disable the 'send to' menu in converation windows if there's only one
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22725
diff changeset
3844 static gboolean
35c7cd1e4771 Disable the 'send to' menu in converation windows if there's only one
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22725
diff changeset
3845 compare_buddy_presence(PurplePresence *p1, PurplePresence *p2)
35c7cd1e4771 Disable the 'send to' menu in converation windows if there's only one
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22725
diff changeset
3846 {
35c7cd1e4771 Disable the 'send to' menu in converation windows if there's only one
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22725
diff changeset
3847 /* This is necessary because multiple PurpleBuddy's don't share the same
35c7cd1e4771 Disable the 'send to' menu in converation windows if there's only one
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22725
diff changeset
3848 * PurplePresence anymore.
35c7cd1e4771 Disable the 'send to' menu in converation windows if there's only one
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22725
diff changeset
3849 */
35c7cd1e4771 Disable the 'send to' menu in converation windows if there's only one
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22725
diff changeset
3850 PurpleBuddy *b1 = purple_presence_get_buddy(p1);
35c7cd1e4771 Disable the 'send to' menu in converation windows if there's only one
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22725
diff changeset
3851 PurpleBuddy *b2 = purple_presence_get_buddy(p2);
35c7cd1e4771 Disable the 'send to' menu in converation windows if there's only one
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22725
diff changeset
3852 if (purple_buddy_get_account(b1) == purple_buddy_get_account(b2) &&
35c7cd1e4771 Disable the 'send to' menu in converation windows if there's only one
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22725
diff changeset
3853 strcmp(purple_buddy_get_name(b1), purple_buddy_get_name(b2)) == 0)
35c7cd1e4771 Disable the 'send to' menu in converation windows if there's only one
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22725
diff changeset
3854 return FALSE;
35c7cd1e4771 Disable the 'send to' menu in converation windows if there's only one
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22725
diff changeset
3855 return TRUE;
35c7cd1e4771 Disable the 'send to' menu in converation windows if there's only one
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22725
diff changeset
3856 }
35c7cd1e4771 Disable the 'send to' menu in converation windows if there's only one
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22725
diff changeset
3857
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3858 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3859 generate_send_to_items(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3860 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3861 GtkWidget *menu;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3862 GSList *group = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3863 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
3864 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3865 GSList *l, *buds;
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 g_return_if_fail(win != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3868
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3869 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
3870
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3871 g_return_if_fail(gtkconv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3872
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3873 if (win->menu.send_to != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3874 gtk_widget_destroy(win->menu.send_to);
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 /* Build the Send To menu */
20545
4a8407152e9a Change _Send To mnemonic to avoid conflicting with Smile
Sean Egan <seanegan@gmail.com>
parents: 20173
diff changeset
3877 win->menu.send_to = gtk_menu_item_new_with_mnemonic(_("S_end To"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3878 gtk_widget_show(win->menu.send_to);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3879
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3880 menu = gtk_menu_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3881 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
3882 win->menu.send_to, 2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3883 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
3884
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3885 gtk_widget_show(menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3886
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3887 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
3888 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
3889
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3890 if (buds == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3891 {
22732
35c7cd1e4771 Disable the 'send to' menu in converation windows if there's only one
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22725
diff changeset
3892 /* The user isn't on the buddy list. So we don't create any sendto menu. */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3893 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3894 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3895 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3896 GList *list = NULL, *iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3897 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
3898 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3899 PurpleBlistNode *node;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3900
25318
0e08c847517d Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents: 24292
diff changeset
3901 node = PURPLE_BLIST_NODE(purple_buddy_get_contact(PURPLE_BUDDY(l->data)));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3902
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3903 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
3904 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3905 PurpleBuddy *buddy = (PurpleBuddy *)node;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3906 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3907
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3908 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
3909 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3910
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3911 account = purple_buddy_get_account(buddy);
30993
e787b5d9ee7d Allow using the Send To menu in the case that the active conversation's account
pidgin@keithmoyer.com
parents: 30863
diff changeset
3912 if (purple_account_is_connected(account) || account == gtkconv->active_conv->account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3913 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3914 /* Use the PurplePresence to get unique buddies. */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3915 PurplePresence *presence = purple_buddy_get_presence(buddy);
22732
35c7cd1e4771 Disable the 'send to' menu in converation windows if there's only one
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22725
diff changeset
3916 if (!g_list_find_custom(list, presence, (GCompareFunc)compare_buddy_presence))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3917 list = g_list_prepend(list, presence);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3918 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3919 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3920 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3921
22732
35c7cd1e4771 Disable the 'send to' menu in converation windows if there's only one
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22725
diff changeset
3922 /* Create the sendto menu only if it has more than one item to show */
35c7cd1e4771 Disable the 'send to' menu in converation windows if there's only one
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22725
diff changeset
3923 if (list && list->next) {
35c7cd1e4771 Disable the 'send to' menu in converation windows if there's only one
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22725
diff changeset
3924 /* Loop over the list backwards so we get the items in the right order,
35c7cd1e4771 Disable the 'send to' menu in converation windows if there's only one
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22725
diff changeset
3925 * since we did a g_list_prepend() earlier. */
35c7cd1e4771 Disable the 'send to' menu in converation windows if there's only one
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22725
diff changeset
3926 for (iter = g_list_last(list); iter != NULL; iter = iter->prev) {
35c7cd1e4771 Disable the 'send to' menu in converation windows if there's only one
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22725
diff changeset
3927 PurplePresence *pre = iter->data;
35c7cd1e4771 Disable the 'send to' menu in converation windows if there's only one
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22725
diff changeset
3928 PurpleBuddy *buddy = purple_presence_get_buddy(pre);
35c7cd1e4771 Disable the 'send to' menu in converation windows if there's only one
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22725
diff changeset
3929 create_sendto_item(menu, sg, &group, buddy,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3930 purple_buddy_get_account(buddy), purple_buddy_get_name(buddy));
22732
35c7cd1e4771 Disable the 'send to' menu in converation windows if there's only one
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22725
diff changeset
3931 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3932 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3933 g_list_free(list);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3934 g_slist_free(buds);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3935 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3936 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3937
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3938 g_object_unref(sg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3939
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3940 gtk_widget_show(win->menu.send_to);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3941 /* 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
3942 if (!group)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3943 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
3944 update_send_to_selection(win);
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
26721
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
3947 static const char *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3948 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
3949 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3950 const char *image = NULL;
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 if (flags & PURPLE_CBFLAGS_FOUNDER) {
15699
1229a0cd9126 docklet pending status
Sean Egan <seanegan@gmail.com>
parents: 15672
diff changeset
3953 image = PIDGIN_STOCK_STATUS_FOUNDER;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3954 } 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
3955 image = PIDGIN_STOCK_STATUS_OPERATOR;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3956 } 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
3957 image = PIDGIN_STOCK_STATUS_HALFOP;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3958 } 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
3959 image = PIDGIN_STOCK_STATUS_VOICE;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3960 } 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
3961 image = PIDGIN_STOCK_STATUS_IGNORED;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3962 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3963 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3964 }
26721
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
3965 return image;
15374
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3968 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3969 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
3970 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3971 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3972 PidginChatPane *gtkchat;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3973 PurpleConvChat *chat;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3974 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3975 PurplePluginProtocolInfo *prpl_info;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3976 GtkListStore *ls;
26721
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
3977 const char *stock;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3978 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3979 gboolean is_me = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3980 gboolean is_buddy;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3981 gchar *tmp, *alias_key, *name, *alias;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3982 int flags;
23005
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
3983 GdkColor *color = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3984
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3985 alias = cb->alias;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3986 name = cb->name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3987 flags = GPOINTER_TO_INT(cb->flags);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3988
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3989 chat = PURPLE_CONV_CHAT(conv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3990 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3991 gtkchat = gtkconv->u.chat;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3992 gc = purple_conversation_get_gc(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3993
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3994 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
3995 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3996
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3997 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
3998
26721
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
3999 stock = get_chat_buddy_status_icon(chat, name, flags);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4000
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4001 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
4002 is_me = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4003
18305
ffd706ec0220 Set and use convchatbuddy->buddy.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18302
diff changeset
4004 is_buddy = cb->buddy;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4005
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4006 tmp = g_utf8_casefold(alias, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4007 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
4008 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4009
23005
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
4010 if (is_me) {
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
4011 GtkTextTag *tag = gtk_text_tag_table_lookup(
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
4012 gtk_text_buffer_get_tag_table(GTK_IMHTML(gtkconv->imhtml)->text_buffer),
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
4013 "send-name");
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
4014 g_object_get(tag, "foreground-gdk", &color, NULL);
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
4015 } else {
26718
9e0001caa207 Italicize nicks in the conversation history for folks leaving a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26623
diff changeset
4016 GtkTextTag *tag;
9e0001caa207 Italicize nicks in the conversation history for folks leaving a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26623
diff changeset
4017 if ((tag = get_buddy_tag(conv, name, 0, FALSE)))
9e0001caa207 Italicize nicks in the conversation history for folks leaving a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26623
diff changeset
4018 g_object_set(G_OBJECT(tag), "style", PANGO_STYLE_NORMAL, NULL);
9e0001caa207 Italicize nicks in the conversation history for folks leaving a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26623
diff changeset
4019 if ((tag = get_buddy_tag(conv, name, PURPLE_MESSAGE_NICK, FALSE)))
9e0001caa207 Italicize nicks in the conversation history for folks leaving a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26623
diff changeset
4020 g_object_set(G_OBJECT(tag), "style", PANGO_STYLE_NORMAL, NULL);
23005
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
4021 color = (GdkColor*)get_nick_color(gtkconv, name);
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
4022 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4023
23005
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
4024 gtk_list_store_insert_with_values(ls, &iter,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4025 /*
23005
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
4026 * The GTK docs are mute about the effects of the "row" value for performance.
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
4027 * X-Chat hardcodes their value to 0 (prepend) and -1 (append), so we will too.
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
4028 * It *might* be faster to search the gtk_list_store and set row accurately,
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
4029 * but no one in #gtk+ seems to know anything about it either.
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
4030 * Inserting in the "wrong" location has no visible ill effects. - F.P.
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
4031 */
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
4032 -1, /* "row" */
26721
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
4033 CHAT_USERS_ICON_STOCK_COLUMN, stock,
23005
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
4034 CHAT_USERS_ALIAS_COLUMN, alias,
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
4035 CHAT_USERS_ALIAS_KEY_COLUMN, alias_key,
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
4036 CHAT_USERS_NAME_COLUMN, name,
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
4037 CHAT_USERS_FLAGS_COLUMN, flags,
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
4038 CHAT_USERS_COLOR_COLUMN, color,
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
4039 CHAT_USERS_WEIGHT_COLUMN, is_buddy ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL,
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
4040 -1);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4041
23005
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
4042 if (is_me && color)
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
4043 gdk_color_free(color);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4044 g_free(alias_key);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4045 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4046
29387
88c462455bc8 Document this function and remove the unused "command" variable
Mark Doliner <mark@kingant.net>
parents: 29378
diff changeset
4047 /**
88c462455bc8 Document this function and remove the unused "command" variable
Mark Doliner <mark@kingant.net>
parents: 29378
diff changeset
4048 * @param most_matched Used internally by this function.
88c462455bc8 Document this function and remove the unused "command" variable
Mark Doliner <mark@kingant.net>
parents: 29378
diff changeset
4049 * @param entered The partial string that the user types before hitting the
88c462455bc8 Document this function and remove the unused "command" variable
Mark Doliner <mark@kingant.net>
parents: 29378
diff changeset
4050 * tab key.
88c462455bc8 Document this function and remove the unused "command" variable
Mark Doliner <mark@kingant.net>
parents: 29378
diff changeset
4051 * @param entered_bytes The length of entered.
88c462455bc8 Document this function and remove the unused "command" variable
Mark Doliner <mark@kingant.net>
parents: 29378
diff changeset
4052 * @param partial This is a return variable. This will be set to a string
88c462455bc8 Document this function and remove the unused "command" variable
Mark Doliner <mark@kingant.net>
parents: 29378
diff changeset
4053 * containing the largest common string between all matches. This will
88c462455bc8 Document this function and remove the unused "command" variable
Mark Doliner <mark@kingant.net>
parents: 29378
diff changeset
4054 * be inserted into the input box at the start of the word that the
88c462455bc8 Document this function and remove the unused "command" variable
Mark Doliner <mark@kingant.net>
parents: 29378
diff changeset
4055 * user is tab completing. For example, if a chat room contains
88c462455bc8 Document this function and remove the unused "command" variable
Mark Doliner <mark@kingant.net>
parents: 29378
diff changeset
4056 * "AlfFan" and "AlfHater" and the user types "a<TAB>" then this will
88c462455bc8 Document this function and remove the unused "command" variable
Mark Doliner <mark@kingant.net>
parents: 29378
diff changeset
4057 * contain "Alf"
88c462455bc8 Document this function and remove the unused "command" variable
Mark Doliner <mark@kingant.net>
parents: 29378
diff changeset
4058 * @param nick_partial Used internally by this function. Shoudl be a
88c462455bc8 Document this function and remove the unused "command" variable
Mark Doliner <mark@kingant.net>
parents: 29378
diff changeset
4059 * temporary buffer that is entered_bytes+1 bytes long.
88c462455bc8 Document this function and remove the unused "command" variable
Mark Doliner <mark@kingant.net>
parents: 29378
diff changeset
4060 * @param matches This is a return variable. If the given name is a potential
88c462455bc8 Document this function and remove the unused "command" variable
Mark Doliner <mark@kingant.net>
parents: 29378
diff changeset
4061 * match for the entered string, then add a copy of the name to this
88c462455bc8 Document this function and remove the unused "command" variable
Mark Doliner <mark@kingant.net>
parents: 29378
diff changeset
4062 * list. The caller is responsible for g_free'ing the data in this
88c462455bc8 Document this function and remove the unused "command" variable
Mark Doliner <mark@kingant.net>
parents: 29378
diff changeset
4063 * list.
88c462455bc8 Document this function and remove the unused "command" variable
Mark Doliner <mark@kingant.net>
parents: 29378
diff changeset
4064 * @param name The buddy name or alias or slash command name that we're
88c462455bc8 Document this function and remove the unused "command" variable
Mark Doliner <mark@kingant.net>
parents: 29378
diff changeset
4065 * checking for a match.
88c462455bc8 Document this function and remove the unused "command" variable
Mark Doliner <mark@kingant.net>
parents: 29378
diff changeset
4066 */
88c462455bc8 Document this function and remove the unused "command" variable
Mark Doliner <mark@kingant.net>
parents: 29378
diff changeset
4067 static void
88c462455bc8 Document this function and remove the unused "command" variable
Mark Doliner <mark@kingant.net>
parents: 29378
diff changeset
4068 tab_complete_process_item(int *most_matched, const char *entered, gsize entered_bytes, char **partial, char *nick_partial,
88c462455bc8 Document this function and remove the unused "command" variable
Mark Doliner <mark@kingant.net>
parents: 29378
diff changeset
4069 GList **matches, char *name)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4070 {
22781
e1052f4b0254 Modified patch from Andrei Mozzhuhin to fix tab-completion when non-ascii
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22733
diff changeset
4071 memcpy(nick_partial, name, entered_bytes);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4072 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
4073 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4074
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4075 /* 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
4076
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4077 if (*most_matched == -1) {
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 * 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
4080 * on *most_matched is >= 0
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4081 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4082 *most_matched = strlen(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4083 *partial = g_strdup(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4084 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4085 else if (*most_matched) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4086 char *tmp = g_strdup(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4087
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4088 while (purple_utf8_strcasecmp(tmp, *partial)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4089 (*partial)[*most_matched] = '\0';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4090 if (*most_matched < strlen(tmp))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4091 tmp[*most_matched] = '\0';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4092 (*most_matched)--;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4093 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4094 (*most_matched)++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4095
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4096 g_free(tmp);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4099 *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
4100 (GCompareFunc)purple_utf8_strcasecmp);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4101 }
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 static gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4104 tab_complete(PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4105 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4106 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4107 GtkTextIter cursor, word_start, start_buffer;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4108 int start;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4109 int most_matched = -1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4110 char *entered, *partial = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4111 char *text;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4112 char *nick_partial;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4113 const char *prefix;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4114 GList *matches = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4115 gboolean command = FALSE;
22781
e1052f4b0254 Modified patch from Andrei Mozzhuhin to fix tab-completion when non-ascii
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22733
diff changeset
4116 gsize entered_bytes = 0;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4117
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4118 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4119
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4120 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
4121 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
4122 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
4123
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4124 word_start = cursor;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4125
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4126 /* if there's nothing there just return */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4127 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
4128 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
4129
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4130 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
4131 &cursor, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4132
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4133 /* 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
4134 start = strlen(text) - 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4135
22781
e1052f4b0254 Modified patch from Andrei Mozzhuhin to fix tab-completion when non-ascii
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22733
diff changeset
4136 if (start >= 1 && !strncmp(&text[start-1], ": ", 2)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4137 gtk_text_iter_backward_chars(&word_start, 2);
22781
e1052f4b0254 Modified patch from Andrei Mozzhuhin to fix tab-completion when non-ascii
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22733
diff changeset
4138 }
e1052f4b0254 Modified patch from Andrei Mozzhuhin to fix tab-completion when non-ascii
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22733
diff changeset
4139
e1052f4b0254 Modified patch from Andrei Mozzhuhin to fix tab-completion when non-ascii
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22733
diff changeset
4140 /* find the start of the word that we're tabbing.
e1052f4b0254 Modified patch from Andrei Mozzhuhin to fix tab-completion when non-ascii
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22733
diff changeset
4141 * Using gtk_text_iter_backward_word_start won't work, because a nick can contain
e1052f4b0254 Modified patch from Andrei Mozzhuhin to fix tab-completion when non-ascii
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22733
diff changeset
4142 * characters (e.g. '.', '/' etc.) that Pango may think are word separators. */
e1052f4b0254 Modified patch from Andrei Mozzhuhin to fix tab-completion when non-ascii
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22733
diff changeset
4143 while (gtk_text_iter_backward_char(&word_start)) {
e1052f4b0254 Modified patch from Andrei Mozzhuhin to fix tab-completion when non-ascii
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22733
diff changeset
4144 if (gtk_text_iter_get_char(&word_start) == ' ') {
e1052f4b0254 Modified patch from Andrei Mozzhuhin to fix tab-completion when non-ascii
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22733
diff changeset
4145 /* Reached the whitespace before the start of the word. Move forward once */
e1052f4b0254 Modified patch from Andrei Mozzhuhin to fix tab-completion when non-ascii
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22733
diff changeset
4146 gtk_text_iter_forward_char(&word_start);
e1052f4b0254 Modified patch from Andrei Mozzhuhin to fix tab-completion when non-ascii
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22733
diff changeset
4147 break;
e1052f4b0254 Modified patch from Andrei Mozzhuhin to fix tab-completion when non-ascii
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22733
diff changeset
4148 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4149 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4150
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4151 prefix = pidgin_get_cmd_prefix();
22781
e1052f4b0254 Modified patch from Andrei Mozzhuhin to fix tab-completion when non-ascii
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22733
diff changeset
4152 if (gtk_text_iter_get_offset(&word_start) == 0 &&
e1052f4b0254 Modified patch from Andrei Mozzhuhin to fix tab-completion when non-ascii
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22733
diff changeset
4153 (strlen(text) >= strlen(prefix)) && !strncmp(text, prefix, strlen(prefix))) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4154 command = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4155 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
4156 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4157
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4158 g_free(text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4159
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4160 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
4161 &cursor, FALSE);
22781
e1052f4b0254 Modified patch from Andrei Mozzhuhin to fix tab-completion when non-ascii
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22733
diff changeset
4162 entered_bytes = strlen(entered);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4163
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4164 if (!g_utf8_strlen(entered, -1)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4165 g_free(entered);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4166 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
4167 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4168
22781
e1052f4b0254 Modified patch from Andrei Mozzhuhin to fix tab-completion when non-ascii
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22733
diff changeset
4169 nick_partial = g_malloc0(entered_bytes + 1);
15374
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 if (command) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4172 GList *list = purple_cmd_list(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4173 GList *l;
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 /* Commands */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4176 for (l = list; l != NULL; l = l->next) {
22781
e1052f4b0254 Modified patch from Andrei Mozzhuhin to fix tab-completion when non-ascii
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22733
diff changeset
4177 tab_complete_process_item(&most_matched, entered, entered_bytes, &partial, nick_partial,
29387
88c462455bc8 Document this function and remove the unused "command" variable
Mark Doliner <mark@kingant.net>
parents: 29378
diff changeset
4178 &matches, l->data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4179 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4180 g_list_free(list);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4181 } 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
4182 PurpleConvChat *chat = PURPLE_CONV_CHAT(conv);
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
4183 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
4184 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
4185 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4186 int f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4187
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4188 /* Users */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4189 for (; l != NULL; l = l->next) {
22781
e1052f4b0254 Modified patch from Andrei Mozzhuhin to fix tab-completion when non-ascii
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22733
diff changeset
4190 tab_complete_process_item(&most_matched, entered, entered_bytes, &partial, nick_partial,
29387
88c462455bc8 Document this function and remove the unused "command" variable
Mark Doliner <mark@kingant.net>
parents: 29378
diff changeset
4191 &matches, ((PurpleConvChatBuddy *)l->data)->name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4192 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4193
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4194
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4195 /* Aliases */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4196 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
4197 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4198 do {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4199 char *name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4200 char *alias;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4201
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4202 gtk_tree_model_get(model, &iter,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4203 CHAT_USERS_NAME_COLUMN, &name,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4204 CHAT_USERS_ALIAS_COLUMN, &alias,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4205 -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4206
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
4207 if (name && alias && strcmp(name, alias))
22781
e1052f4b0254 Modified patch from Andrei Mozzhuhin to fix tab-completion when non-ascii
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22733
diff changeset
4208 tab_complete_process_item(&most_matched, entered, entered_bytes, &partial, nick_partial,
29387
88c462455bc8 Document this function and remove the unused "command" variable
Mark Doliner <mark@kingant.net>
parents: 29378
diff changeset
4209 &matches, alias);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4210 g_free(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4211 g_free(alias);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4212
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4213 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
4214 } while (f != 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4215 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4216 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4217 g_free(nick_partial);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4218 g_free(entered);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4219 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4220 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4221
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4222 g_free(nick_partial);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4223
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4224 /* 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
4225
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4226 /* if there weren't any matches, return */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4227 if (!matches) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4228 /* 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
4229 g_free(entered);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4230 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
4231 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4232
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4233 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
4234
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4235 if (!matches->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4236 /* 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
4237 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
4238 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
4239 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
4240
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4241 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
4242 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
4243 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
4244 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4245 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4246 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4247 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
4248 matches->data, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4249
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4250 g_free(matches->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4251 matches = g_list_remove(matches, matches->data);
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 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4254 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4255 * 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
4256 * and display all of them
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 char *addthis = g_malloc0(1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4259
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4260 while (matches) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4261 char *tmp = addthis;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4262 addthis = g_strconcat(tmp, matches->data, " ", NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4263 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4264 g_free(matches->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4265 matches = g_list_remove(matches, matches->data);
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
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4268 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
4269 time(NULL));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4270 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
4271 g_free(addthis);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4274 g_free(entered);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4275 g_free(partial);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4276
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4277 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4278 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4279
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4280 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
4281 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4282 PurplePluginProtocolInfo *prpl_info = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4283 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4284 PurpleConversation *conv = gtkconv->active_conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4285 PidginChatPane *gtkchat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4286 char *new_topic;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4287 const char *current_topic;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4288
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4289 gc = purple_conversation_get_gc(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4290
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4291 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
4292 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4293
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4294 if(prpl_info->set_chat_topic == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4295 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4296
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4297 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4298 gtkchat = gtkconv->u.chat;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4299 new_topic = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtkchat->topic_text)));
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4300 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
4301
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4302 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
4303 g_free(new_topic);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4304 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4305 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4306
28195
d1040bb86b6a Avoid an assertion when setting a room topic for the first time.
Paul Aurich <paul@darkrain42.org>
parents: 28178
diff changeset
4307 if (current_topic)
d1040bb86b6a Avoid an assertion when setting a room topic for the first time.
Paul Aurich <paul@darkrain42.org>
parents: 28178
diff changeset
4308 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), current_topic);
d1040bb86b6a Avoid an assertion when setting a room topic for the first time.
Paul Aurich <paul@darkrain42.org>
parents: 28178
diff changeset
4309 else
d1040bb86b6a Avoid an assertion when setting a room topic for the first time.
Paul Aurich <paul@darkrain42.org>
parents: 28178
diff changeset
4310 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), "");
d1040bb86b6a Avoid an assertion when setting a room topic for the first time.
Paul Aurich <paul@darkrain42.org>
parents: 28178
diff changeset
4311
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4312 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
4313 new_topic);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4314
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4315 g_free(new_topic);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4316 }
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 static gint
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4319 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
4320 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4321 PurpleConvChatBuddyFlags f1 = 0, f2 = 0;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4322 char *user1 = NULL, *user2 = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4323 gboolean buddy1 = FALSE, buddy2 = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4324 gint ret = 0;
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 gtk_tree_model_get(model, a,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4327 CHAT_USERS_ALIAS_KEY_COLUMN, &user1,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4328 CHAT_USERS_FLAGS_COLUMN, &f1,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4329 CHAT_USERS_WEIGHT_COLUMN, &buddy1,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4330 -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4331 gtk_tree_model_get(model, b,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4332 CHAT_USERS_ALIAS_KEY_COLUMN, &user2,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4333 CHAT_USERS_FLAGS_COLUMN, &f2,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4334 CHAT_USERS_WEIGHT_COLUMN, &buddy2,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4335 -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4336
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4337 if (user1 == NULL || user2 == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4338 if (!(user1 == NULL && user2 == NULL))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4339 ret = (user1 == NULL) ? -1: 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4340 } else if (f1 != f2) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4341 /* sort more important users first */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4342 ret = (f1 > f2) ? -1 : 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4343 } else if (buddy1 != buddy2) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4344 ret = (buddy1 > buddy2) ? -1 : 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4345 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4346 ret = strcmp(user1, user2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4347 }
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 g_free(user1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4350 g_free(user2);
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 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4353 }
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 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4356 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
4357 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4358 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4359 PurpleConvChat *chat = PURPLE_CONV_CHAT(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4360 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4361 char *normalized_name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4362 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4363 int f;
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 g_return_if_fail(buddy != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4366 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4367
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4368 /* 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
4369 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
4370
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4371 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
4372 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4373
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4374 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
4375
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4376 do {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4377 char *name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4378
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4379 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
4380
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4381 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
4382 const char *alias = name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4383 char *tmp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4384 char *alias_key = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4385 PurpleBuddy *buddy2;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4386
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4387 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
4388 /* 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
4389
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4390 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
4391 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
4392 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4393
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4394 tmp = g_utf8_casefold(alias, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4395 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
4396 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4397
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4398 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
4399 CHAT_USERS_ALIAS_COLUMN, alias,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4400 CHAT_USERS_ALIAS_KEY_COLUMN, alias_key,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4401 -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4402 g_free(alias_key);
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 g_free(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4405 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4406 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4407
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4408 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
4409
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4410 g_free(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4411 } while (f != 0);
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 g_free(normalized_name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4414 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4415
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4416 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4417 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
4418 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4419 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4420 PurplePluginProtocolInfo *prpl_info;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4421
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4422 g_return_if_fail(node != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4423 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4424
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4425 gc = purple_conversation_get_gc(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4426 g_return_if_fail(gc != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4427 g_return_if_fail(gc->prpl != NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4428 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
4429
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4430 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
4431 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4432
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4433 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
4434 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4435 PurpleBlistNode *bnode;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4436
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4437 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
4438
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4439 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
4440 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4441
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4442 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
4443 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4444 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4445 else if (PURPLE_BLIST_NODE_IS_BUDDY(node))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4446 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
4447 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
4448 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
4449 {
c30dae34dd33 Update the tab-title for chats immediately after aliasing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17106
diff changeset
4450 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
4451 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
4452 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4453 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4454
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4455 static void
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4456 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
4457 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4458 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4459 char *normalized_name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4460 GtkTreeIter iter;
23005
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
4461 GtkTextTag *texttag;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4462 int f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4463
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4464 g_return_if_fail(buddy != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4465 g_return_if_fail(conv != NULL);
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 /* 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
4468 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
4469 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4470
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4471 /* 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
4472 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
4473
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4474 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
4475 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4476
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4477 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
4478
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4479 do {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4480 char *name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4481
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4482 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
4483
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4484 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
4485 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
4486 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
4487 g_free(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4488 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4489 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4490
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4491 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
4492
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4493 g_free(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4494 } while (f != 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4495
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4496 g_free(normalized_name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4497
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4498 blist_node_aliased_cb((PurpleBlistNode *)buddy, NULL, conv);
23005
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
4499
24267
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
4500 texttag = get_buddy_tag(conv, purple_buddy_get_name(buddy), 0, FALSE); /* XXX: do we want the normalized name? */
23005
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
4501 if (texttag) {
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
4502 g_object_set(texttag, "weight", is_buddy ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL, NULL);
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
4503 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4504 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4505
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4506 static void
26878
0924698e2362 Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents: 26727
diff changeset
4507 buddy_added_cb(PurpleBlistNode *node, PurpleConversation *conv)
0924698e2362 Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents: 26727
diff changeset
4508 {
0924698e2362 Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents: 26727
diff changeset
4509 if (!PURPLE_BLIST_NODE_IS_BUDDY(node))
0924698e2362 Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents: 26727
diff changeset
4510 return;
0924698e2362 Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents: 26727
diff changeset
4511
0924698e2362 Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents: 26727
diff changeset
4512 buddy_cb_common(PURPLE_BUDDY(node), conv, TRUE);
0924698e2362 Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents: 26727
diff changeset
4513 }
0924698e2362 Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents: 26727
diff changeset
4514
0924698e2362 Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents: 26727
diff changeset
4515 static void
0924698e2362 Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents: 26727
diff changeset
4516 buddy_removed_cb(PurpleBlistNode *node, PurpleConversation *conv)
0924698e2362 Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents: 26727
diff changeset
4517 {
0924698e2362 Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents: 26727
diff changeset
4518 if (!PURPLE_BLIST_NODE_IS_BUDDY(node))
0924698e2362 Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents: 26727
diff changeset
4519 return;
0924698e2362 Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents: 26727
diff changeset
4520
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4521 /* If there's another buddy for the same "dude" on the list, do nothing. */
26878
0924698e2362 Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents: 26727
diff changeset
4522 if (purple_find_buddy(purple_buddy_get_account(PURPLE_BUDDY(node)),
0924698e2362 Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents: 26727
diff changeset
4523 purple_buddy_get_name(PURPLE_BUDDY(node))) != NULL)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4524 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4525
26878
0924698e2362 Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents: 26727
diff changeset
4526 buddy_cb_common(PURPLE_BUDDY(node), conv, FALSE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4527 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4528
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4529 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
4530 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4531 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
4532 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4533
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4534 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4535 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
4536 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4537 GtkWidget *menuitem;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4538 PidginConversation *gtkconv = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4539
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4540 g_return_if_fail(menu != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4541 g_return_if_fail(gtkconv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4542
15560
442128853bdb toolbar/menu icons. reduce the imhtmltoolbar spacing. more gaimstock pruning
Sean Egan <seanegan@gmail.com>
parents: 15557
diff changeset
4543 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
4544 G_CALLBACK(send_menu_cb), gtkconv,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4545 0, 0, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4546 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
4547 gtk_widget_set_sensitive(menuitem, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4548 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
4549
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4550 menuitem = gtk_separator_menu_item_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4551 gtk_widget_show(menuitem);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4552 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
4553 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4554
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
4555 static gboolean resize_imhtml_cb(PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4556 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4557 GtkTextBuffer *buffer;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4558 GtkTextIter iter;
20837
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4559 int lines;
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4560 GdkRectangle oneline;
20838
effa512ad24a fix the auto resize code for the showing formatting toolbar case, which
Ka-Hing Cheung <khc@hxbc.us>
parents: 20837
diff changeset
4561 int height, diff;
20837
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4562 int pad_top, pad_inside, pad_bottom;
22791
9cbb7c2aba23 This should fix the issue where resizing the entry box resizes the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22785
diff changeset
4563 int total_height = (gtkconv->imhtml->allocation.height + gtkconv->entry->allocation.height);
9cbb7c2aba23 This should fix the issue where resizing the entry box resizes the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22785
diff changeset
4564 int max_height = total_height / 2;
22802
958f9379eb1a Add a "minimum lines" pref for the im entry box thing; up to 8 lines.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22791
diff changeset
4565 int min_lines = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/minimum_entry_lines");
22791
9cbb7c2aba23 This should fix the issue where resizing the entry box resizes the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22785
diff changeset
4566 int min_height;
29282
5c2bbeef2eb8 Patch from Gabriel Schulhof to correctly size the GtkIMHtml entry in the
Gabriel Schulhof <nix@go-nix.ca>
parents: 29261
diff changeset
4567 gboolean interior_focus;
5c2bbeef2eb8 Patch from Gabriel Schulhof to correctly size the GtkIMHtml entry in the
Gabriel Schulhof <nix@go-nix.ca>
parents: 29261
diff changeset
4568 int focus_width;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4569
20837
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4570 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
4571 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
4572 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
4573
22601
357809e70305 Change the height-calculation of the entry widget a little bit. This should make it better when text with smileys is pasted. If this is even more buggy than it currently is, let me know\! Fixes #5426.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22485
diff changeset
4574 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry));
357809e70305 Change the height-calculation of the entry widget a little bit. This should make it better when text with smileys is pasted. If this is even more buggy than it currently is, let me know\! Fixes #5426.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22485
diff changeset
4575 gtk_text_buffer_get_start_iter(buffer, &iter);
357809e70305 Change the height-calculation of the entry widget a little bit. This should make it better when text with smileys is pasted. If this is even more buggy than it currently is, let me know\! Fixes #5426.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22485
diff changeset
4576 gtk_text_view_get_iter_location(GTK_TEXT_VIEW(gtkconv->entry), &iter, &oneline);
357809e70305 Change the height-calculation of the entry widget a little bit. This should make it better when text with smileys is pasted. If this is even more buggy than it currently is, let me know\! Fixes #5426.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22485
diff changeset
4577
357809e70305 Change the height-calculation of the entry widget a little bit. This should make it better when text with smileys is pasted. If this is even more buggy than it currently is, let me know\! Fixes #5426.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22485
diff changeset
4578 lines = gtk_text_buffer_get_line_count(buffer);
357809e70305 Change the height-calculation of the entry widget a little bit. This should make it better when text with smileys is pasted. If this is even more buggy than it currently is, let me know\! Fixes #5426.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22485
diff changeset
4579
357809e70305 Change the height-calculation of the entry widget a little bit. This should make it better when text with smileys is pasted. If this is even more buggy than it currently is, let me know\! Fixes #5426.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22485
diff changeset
4580 height = 0;
357809e70305 Change the height-calculation of the entry widget a little bit. This should make it better when text with smileys is pasted. If this is even more buggy than it currently is, let me know\! Fixes #5426.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22485
diff changeset
4581 do {
357809e70305 Change the height-calculation of the entry widget a little bit. This should make it better when text with smileys is pasted. If this is even more buggy than it currently is, let me know\! Fixes #5426.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22485
diff changeset
4582 int lineheight = 0;
357809e70305 Change the height-calculation of the entry widget a little bit. This should make it better when text with smileys is pasted. If this is even more buggy than it currently is, let me know\! Fixes #5426.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22485
diff changeset
4583 gtk_text_view_get_line_yrange(GTK_TEXT_VIEW(gtkconv->entry), &iter, NULL, &lineheight);
357809e70305 Change the height-calculation of the entry widget a little bit. This should make it better when text with smileys is pasted. If this is even more buggy than it currently is, let me know\! Fixes #5426.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22485
diff changeset
4584 height += lineheight;
357809e70305 Change the height-calculation of the entry widget a little bit. This should make it better when text with smileys is pasted. If this is even more buggy than it currently is, let me know\! Fixes #5426.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22485
diff changeset
4585 lines--;
357809e70305 Change the height-calculation of the entry widget a little bit. This should make it better when text with smileys is pasted. If this is even more buggy than it currently is, let me know\! Fixes #5426.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22485
diff changeset
4586 } while (gtk_text_iter_forward_line(&iter));
357809e70305 Change the height-calculation of the entry widget a little bit. This should make it better when text with smileys is pasted. If this is even more buggy than it currently is, let me know\! Fixes #5426.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22485
diff changeset
4587 height += lines * (oneline.height + pad_top + pad_bottom);
357809e70305 Change the height-calculation of the entry widget a little bit. This should make it better when text with smileys is pasted. If this is even more buggy than it currently is, let me know\! Fixes #5426.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22485
diff changeset
4588
22802
958f9379eb1a Add a "minimum lines" pref for the im entry box thing; up to 8 lines.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22791
diff changeset
4589 /* Make sure there's enough room for at least min_lines. Allocate enough space to
22601
357809e70305 Change the height-calculation of the entry widget a little bit. This should make it better when text with smileys is pasted. If this is even more buggy than it currently is, let me know\! Fixes #5426.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22485
diff changeset
4590 * prevent scrolling when the second line is a continuation of the first line, or
357809e70305 Change the height-calculation of the entry widget a little bit. This should make it better when text with smileys is pasted. If this is even more buggy than it currently is, let me know\! Fixes #5426.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22485
diff changeset
4591 * is the beginning of a new paragraph. */
22802
958f9379eb1a Add a "minimum lines" pref for the im entry box thing; up to 8 lines.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22791
diff changeset
4592 min_height = min_lines * (oneline.height + MAX(pad_inside, pad_top + pad_bottom));
22818
7b21c5b208fb Do not let the height of the entry get larger than half the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22802
diff changeset
4593 height = CLAMP(height, MIN(min_height, max_height), max_height);
22485
43f28905e2fd Limit the text input area to half the conversation's height.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22477
diff changeset
4594
29282
5c2bbeef2eb8 Patch from Gabriel Schulhof to correctly size the GtkIMHtml entry in the
Gabriel Schulhof <nix@go-nix.ca>
parents: 29261
diff changeset
4595 gtk_widget_style_get(gtkconv->entry,
5c2bbeef2eb8 Patch from Gabriel Schulhof to correctly size the GtkIMHtml entry in the
Gabriel Schulhof <nix@go-nix.ca>
parents: 29261
diff changeset
4596 "interior-focus", &interior_focus,
5c2bbeef2eb8 Patch from Gabriel Schulhof to correctly size the GtkIMHtml entry in the
Gabriel Schulhof <nix@go-nix.ca>
parents: 29261
diff changeset
4597 "focus-line-width", &focus_width,
5c2bbeef2eb8 Patch from Gabriel Schulhof to correctly size the GtkIMHtml entry in the
Gabriel Schulhof <nix@go-nix.ca>
parents: 29261
diff changeset
4598 NULL);
5c2bbeef2eb8 Patch from Gabriel Schulhof to correctly size the GtkIMHtml entry in the
Gabriel Schulhof <nix@go-nix.ca>
parents: 29261
diff changeset
4599 if (!interior_focus)
5c2bbeef2eb8 Patch from Gabriel Schulhof to correctly size the GtkIMHtml entry in the
Gabriel Schulhof <nix@go-nix.ca>
parents: 29261
diff changeset
4600 height += 2 * focus_width;
5c2bbeef2eb8 Patch from Gabriel Schulhof to correctly size the GtkIMHtml entry in the
Gabriel Schulhof <nix@go-nix.ca>
parents: 29261
diff changeset
4601
20839
83b662c458de uses the entry's allocated height instead of requested height, works around
Ka-Hing Cheung <khc@hxbc.us>
parents: 20838
diff changeset
4602 diff = height - gtkconv->entry->allocation.height;
22791
9cbb7c2aba23 This should fix the issue where resizing the entry box resizes the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22785
diff changeset
4603 if (ABS(diff) < oneline.height / 2)
22465
77b6ff5bdb07 This should fix the 1px bug. If someone still sees this bug after this change, please let me know.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22437
diff changeset
4604 return FALSE;
20838
effa512ad24a fix the auto resize code for the showing formatting toolbar case, which
Ka-Hing Cheung <khc@hxbc.us>
parents: 20837
diff changeset
4605
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
4606 gtk_widget_set_size_request(gtkconv->lower_hbox, -1,
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
4607 diff + gtkconv->lower_hbox->allocation.height);
22465
77b6ff5bdb07 This should fix the 1px bug. If someone still sees this bug after this change, please let me know.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22437
diff changeset
4608
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
4609 return FALSE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4610 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4611
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4612 static void
22802
958f9379eb1a Add a "minimum lines" pref for the im entry box thing; up to 8 lines.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22791
diff changeset
4613 minimum_entry_lines_pref_cb(const char *name,
958f9379eb1a Add a "minimum lines" pref for the im entry box thing; up to 8 lines.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22791
diff changeset
4614 PurplePrefType type,
958f9379eb1a Add a "minimum lines" pref for the im entry box thing; up to 8 lines.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22791
diff changeset
4615 gconstpointer value,
958f9379eb1a Add a "minimum lines" pref for the im entry box thing; up to 8 lines.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22791
diff changeset
4616 gpointer data)
958f9379eb1a Add a "minimum lines" pref for the im entry box thing; up to 8 lines.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22791
diff changeset
4617 {
958f9379eb1a Add a "minimum lines" pref for the im entry box thing; up to 8 lines.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22791
diff changeset
4618 GList *l = purple_get_conversations();
958f9379eb1a Add a "minimum lines" pref for the im entry box thing; up to 8 lines.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22791
diff changeset
4619 PurpleConversation *conv;
958f9379eb1a Add a "minimum lines" pref for the im entry box thing; up to 8 lines.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22791
diff changeset
4620 while (l != NULL)
958f9379eb1a Add a "minimum lines" pref for the im entry box thing; up to 8 lines.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22791
diff changeset
4621 {
958f9379eb1a Add a "minimum lines" pref for the im entry box thing; up to 8 lines.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22791
diff changeset
4622 conv = (PurpleConversation *)l->data;
958f9379eb1a Add a "minimum lines" pref for the im entry box thing; up to 8 lines.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22791
diff changeset
4623
958f9379eb1a Add a "minimum lines" pref for the im entry box thing; up to 8 lines.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22791
diff changeset
4624 if (PIDGIN_IS_PIDGIN_CONVERSATION(conv))
958f9379eb1a Add a "minimum lines" pref for the im entry box thing; up to 8 lines.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22791
diff changeset
4625 resize_imhtml_cb(PIDGIN_CONVERSATION(conv));
958f9379eb1a Add a "minimum lines" pref for the im entry box thing; up to 8 lines.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22791
diff changeset
4626
958f9379eb1a Add a "minimum lines" pref for the im entry box thing; up to 8 lines.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22791
diff changeset
4627 l = l->next;
958f9379eb1a Add a "minimum lines" pref for the im entry box thing; up to 8 lines.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22791
diff changeset
4628 }
958f9379eb1a Add a "minimum lines" pref for the im entry box thing; up to 8 lines.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22791
diff changeset
4629 }
958f9379eb1a Add a "minimum lines" pref for the im entry box thing; up to 8 lines.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22791
diff changeset
4630
958f9379eb1a Add a "minimum lines" pref for the im entry box thing; up to 8 lines.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22791
diff changeset
4631 static void
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4632 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
4633 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4634 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
4635 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
4636 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
4637 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
4638 {
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4639 GtkWidget *hbox, *label;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4640 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
4641
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
4642 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
4643 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
4644
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4645 label = gtk_label_new(_("Topic:"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4646 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
4647
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4648 gtkchat->topic_text = gtk_entry_new();
26987
1735d1c88d4e Insert an empty widget in chat windows to ensure that the infopane is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26986
diff changeset
4649 gtk_widget_set_size_request(gtkchat->topic_text, -1, BUDDYICON_SIZE_MIN);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4650
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4651 if(prpl_info->set_chat_topic == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4652 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
4653 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4654 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
4655 G_CALLBACK(topic_callback), gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4656 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4657
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4658 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
4659 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
4660 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
4661 }
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4662 }
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4663
21945
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4664 static gboolean
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4665 pidgin_conv_userlist_create_tooltip(GtkWidget *tipwindow, GtkTreePath *path,
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4666 gpointer userdata, int *w, int *h)
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4667 {
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4668 PidginConversation *gtkconv = userdata;
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4669 GtkTreeIter iter;
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4670 GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkconv->u.chat->list));
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4671 PurpleConversation *conv = gtkconv->active_conv;
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4672 PurpleBlistNode *node;
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4673 PurplePluginProtocolInfo *prpl_info;
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4674 PurpleAccount *account = purple_conversation_get_account(conv);
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4675 char *who = NULL;
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4676
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4677 if (account->gc == NULL)
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4678 return FALSE;
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4679
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4680 if (!gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, path))
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4681 return FALSE;
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4682
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4683 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &who, -1);
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4684
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4685 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(account->gc->prpl);
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4686 node = (PurpleBlistNode*)(purple_find_buddy(conv->account, who));
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4687 if (node && prpl_info && (prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME))
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4688 pidgin_blist_draw_tooltip(node, gtkconv->infopane);
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4689
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4690 g_free(who);
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4691 return FALSE;
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4692 }
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4693
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4694 static void
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4695 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
4696 {
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4697 PidginChatPane *gtkchat = gtkconv->u.chat;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4698 GtkWidget *lbox, *sw, *list;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4699 GtkListStore *ls;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4700 GtkCellRenderer *rend;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4701 GtkTreeViewColumn *col;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4702 int ul_width;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4703 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
4704 PurpleConversation *conv = gtkconv->active_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4705
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4706 /* Build the right pane. */
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
4707 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
4708 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
4709 gtk_widget_show(lbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4710
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4711 /* 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
4712 gtkchat->count = gtk_label_new(_("0 people in room"));
23841
3c9711cf1a76 Ellipsize the "n people in room" text if necessary.
Will Thompson <will.thompson@collabora.co.uk>
parents: 23783
diff changeset
4713 gtk_label_set_ellipsize(GTK_LABEL(gtkchat->count), PANGO_ELLIPSIZE_END);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4714 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
4715 gtk_widget_show(gtkchat->count);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4716
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4717 /* Setup the list of users. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4718 sw = gtk_scrolled_window_new(NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4719 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
4720 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4721 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
4722 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
4723 gtk_widget_show(sw);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4724
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4725 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
4726 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT,
26721
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
4727 GDK_TYPE_COLOR, G_TYPE_INT, G_TYPE_STRING);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4728 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
4729 sort_chat_users, NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4730
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4731 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
4732
28687
20b7a51166c3 Allow a user to use gtkrc to style the userlist in chat windows. I don't think
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28635
diff changeset
4733 /* Allow a user to specify gtkrc settings for the chat userlist only */
20b7a51166c3 Allow a user to use gtkrc to style the userlist in chat windows. I don't think
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28635
diff changeset
4734 gtk_widget_set_name(list, "pidgin_conv_userlist");
20b7a51166c3 Allow a user to use gtkrc to style the userlist in chat windows. I don't think
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28635
diff changeset
4735
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4736 rend = gtk_cell_renderer_pixbuf_new();
26721
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
4737 g_object_set(G_OBJECT(rend),
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
4738 "stock-size", gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL),
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
4739 NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4740 col = gtk_tree_view_column_new_with_attributes(NULL, rend,
26721
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
4741 "stock-id", CHAT_USERS_ICON_STOCK_COLUMN, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4742 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
4743 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
4744 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
4745 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
4746
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
4747 /* 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
4748 * 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
4749 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
4750 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
4751
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4752 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
4753 G_CALLBACK(right_click_chat_cb), gtkconv);
22626
2e16a86883c7 Patch from fmoo to make double-clicking or hitting enter on a chatroom user
Will Thompson <will.thompson@collabora.co.uk>
parents: 22613
diff changeset
4754 g_signal_connect(G_OBJECT(list), "row-activated",
2e16a86883c7 Patch from fmoo to make double-clicking or hitting enter on a chatroom user
Will Thompson <will.thompson@collabora.co.uk>
parents: 22613
diff changeset
4755 G_CALLBACK(activate_list_cb), gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4756 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
4757 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
4758 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
4759
21945
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4760 pidgin_tooltip_setup_for_treeview(list, gtkconv,
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4761 pidgin_conv_userlist_create_tooltip, NULL);
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4762
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4763 rend = gtk_cell_renderer_text_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4764 g_object_set(rend,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4765 "foreground-set", TRUE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4766 "weight-set", TRUE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4767 NULL);
26721
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
4768 g_object_set(G_OBJECT(rend), "editable", TRUE, 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
4769
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4770 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
4771 "text", CHAT_USERS_ALIAS_COLUMN,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4772 "foreground-gdk", CHAT_USERS_COLOR_COLUMN,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4773 "weight", CHAT_USERS_WEIGHT_COLUMN,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4774 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4775
26878
0924698e2362 Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents: 26727
diff changeset
4776 purple_signal_connect(blist_handle, "blist-node-added",
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4777 gtkchat, PURPLE_CALLBACK(buddy_added_cb), conv);
26878
0924698e2362 Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents: 26727
diff changeset
4778 purple_signal_connect(blist_handle, "blist-node-removed",
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4779 gtkchat, PURPLE_CALLBACK(buddy_removed_cb), conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4780 purple_signal_connect(blist_handle, "blist-node-aliased",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4781 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
4782
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4783 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
4784 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
4785
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4786 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
4787
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4788 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
4789 gtk_widget_show(list);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4790
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4791 gtkchat->list = list;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4792
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4793 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
4794 }
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4795
18671
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4796 static gboolean
21945
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4797 pidgin_conv_create_tooltip(GtkWidget *tipwindow, gpointer userdata, int *w, int *h)
18671
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4798 {
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4799 PurpleBlistNode *node = NULL;
19227
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4800 PurpleConversation *conv;
21945
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4801 PidginConversation *gtkconv = userdata;
19227
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4802
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4803 conv = gtkconv->active_conv;
19226
a0d45fa8ecfc De-seaneganify some of the indentation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19223
diff changeset
4804 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
4805 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
4806 if (!node)
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4807 node = g_object_get_data(G_OBJECT(gtkconv->imhtml), "transient_chat");
18671
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4808 } else {
19226
a0d45fa8ecfc De-seaneganify some of the indentation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19223
diff changeset
4809 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
4810 #if 0
22437
8802eddbfedc Fix Topic in chat node tooltips, and turn on using the transient chat node
Stu Tomlinson <stu@nosnilmot.com>
parents: 22435
diff changeset
4811 /* Using the transient blist nodes to show the tooltip doesn't quite work yet. */
21821
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4812 if (!node)
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4813 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
4814 #endif
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4815 }
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4816
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4817 if (node)
18671
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4818 pidgin_blist_draw_tooltip(node, gtkconv->infopane);
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4819 return FALSE;
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4820 }
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4821
29718
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4822 /* Quick Find {{{ */
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4823 static gboolean
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4824 pidgin_conv_end_quickfind(PidginConversation *gtkconv)
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4825 {
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4826 gtk_widget_modify_base(gtkconv->quickfind.entry, GTK_STATE_NORMAL, NULL);
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4827
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4828 gtk_imhtml_search_clear(GTK_IMHTML(gtkconv->imhtml));
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4829 gtk_widget_hide_all(gtkconv->quickfind.container);
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4830
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4831 gtk_widget_grab_focus(gtkconv->entry);
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4832 return TRUE;
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4833 }
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4834
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4835 static gboolean
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4836 quickfind_process_input(GtkWidget *entry, GdkEventKey *event, PidginConversation *gtkconv)
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4837 {
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4838 switch (event->keyval) {
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4839 case GDK_Return:
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4840 case GDK_KP_Enter:
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4841 if (gtk_imhtml_search_find(GTK_IMHTML(gtkconv->imhtml), gtk_entry_get_text(GTK_ENTRY(entry)))) {
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4842 gtk_widget_modify_base(gtkconv->quickfind.entry, GTK_STATE_NORMAL, NULL);
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4843 } else {
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4844 GdkColor col;
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4845 col.red = 0xffff;
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4846 col.green = 0xafff;
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4847 col.blue = 0xafff;
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4848 gtk_widget_modify_base(gtkconv->quickfind.entry, GTK_STATE_NORMAL, &col);
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4849 }
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4850 break;
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4851 case GDK_Escape:
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4852 pidgin_conv_end_quickfind(gtkconv);
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4853 break;
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4854 default:
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4855 return FALSE;
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4856 }
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4857 return TRUE;
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4858 }
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4859
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4860 static void
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4861 pidgin_conv_setup_quickfind(PidginConversation *gtkconv, GtkWidget *container)
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4862 {
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4863 GtkWidget *widget = gtk_hbox_new(FALSE, 0);
30134
0625cebc84d7 Use cute little "¡ß" on the close buttons in conversation tabs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 30020
diff changeset
4864 GtkWidget *label, *entry, *close;
29718
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4865
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4866 gtk_box_pack_start(GTK_BOX(container), widget, FALSE, FALSE, 0);
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4867
30134
0625cebc84d7 Use cute little "¡ß" on the close buttons in conversation tabs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 30020
diff changeset
4868 close = pidgin_create_small_button(gtk_label_new("×"));
29718
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4869 gtk_box_pack_start(GTK_BOX(widget), close, FALSE, FALSE, 0);
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4870 gtk_tooltips_set_tip(gtkconv->tooltips, close,
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4871 _("Close Find bar"), NULL);
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4872
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4873 label = gtk_label_new(_("Find:"));
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4874 gtk_box_pack_start(GTK_BOX(widget), label, FALSE, FALSE, 10);
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4875
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4876 entry = gtk_entry_new();
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4877 gtk_box_pack_start(GTK_BOX(widget), entry, TRUE, TRUE, 0);
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4878
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4879 gtkconv->quickfind.entry = entry;
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4880 gtkconv->quickfind.container = widget;
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4881
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4882 /* Hook to signals and stuff */
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4883 g_signal_connect(G_OBJECT(entry), "key_press_event",
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4884 G_CALLBACK(quickfind_process_input), gtkconv);
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4885 g_signal_connect_swapped(G_OBJECT(close), "button-press-event",
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4886 G_CALLBACK(pidgin_conv_end_quickfind), gtkconv);
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4887 }
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4888
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4889 /* }}} */
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
4890
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4891 static GtkWidget *
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4892 setup_common_pane(PidginConversation *gtkconv)
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4893 {
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
4894 GtkWidget *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
4895 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
4896 GtkTreePath *path;
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4897 PurpleConversation *conv = gtkconv->active_conv;
22733
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
4898 PurpleBuddy *buddy;
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4899 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
4900 GtkPolicyType imhtml_sw_hscroll;
22733
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
4901 int buddyicon_size = 0;
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4902
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4903 /* 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
4904 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
4905 gtk_widget_show(vbox);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4906
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
4907 /* 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
4908 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
4909 gtk_event_box_set_visible_window(GTK_EVENT_BOX(event_box), FALSE);
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
4910 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
4911 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
4912 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
4913 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
4914 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
4915 gtk_widget_add_events(event_box,
18671
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4916 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
4917 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
4918 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
4919
21945
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4920 pidgin_tooltip_setup_for_widget(event_box, gtkconv,
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4921 pidgin_conv_create_tooltip, 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
4922
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
4923 gtkconv->infopane = gtk_cell_view_new();
26721
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
4924 gtkconv->infopane_model = gtk_list_store_new(CONV_NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, GDK_TYPE_PIXBUF, GDK_TYPE_PIXBUF);
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25362
diff changeset
4925 gtk_cell_view_set_model(GTK_CELL_VIEW(gtkconv->infopane),
18214
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
4926 GTK_TREE_MODEL(gtkconv->infopane_model));
22678
01b5c9ed85e7 Leak fix. I think. At least valgrind stopped crying about it and nothing
Stu Tomlinson <stu@nosnilmot.com>
parents: 22669
diff changeset
4927 g_object_unref(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
4928 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
4929 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
4930 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
4931 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
4932 gtk_tree_path_free(path);
22733
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
4933
26987
1735d1c88d4e Insert an empty widget in chat windows to ensure that the infopane is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26986
diff changeset
4934 if (chat) {
1735d1c88d4e Insert an empty widget in chat windows to ensure that the infopane is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26986
diff changeset
4935 /* This empty widget is used to ensure that the infopane is consistently
1735d1c88d4e Insert an empty widget in chat windows to ensure that the infopane is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26986
diff changeset
4936 sized for chat windows. The correct fix is to put an icon in the chat
1735d1c88d4e Insert an empty widget in chat windows to ensure that the infopane is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26986
diff changeset
4937 window as well, because that would make "Set Custom Icon" consistent
1735d1c88d4e Insert an empty widget in chat windows to ensure that the infopane is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26986
diff changeset
4938 for both the buddy list and the chat window, but PidginConversation
1735d1c88d4e Insert an empty widget in chat windows to ensure that the infopane is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26986
diff changeset
4939 is pretty much stuck until 3.0. */
1735d1c88d4e Insert an empty widget in chat windows to ensure that the infopane is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26986
diff changeset
4940 GtkWidget *sizing_vbox;
1735d1c88d4e Insert an empty widget in chat windows to ensure that the infopane is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26986
diff changeset
4941 sizing_vbox = gtk_vbox_new(FALSE, 0);
1735d1c88d4e Insert an empty widget in chat windows to ensure that the infopane is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26986
diff changeset
4942 gtk_widget_set_size_request(sizing_vbox, -1, BUDDYICON_SIZE_MIN);
1735d1c88d4e Insert an empty widget in chat windows to ensure that the infopane is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26986
diff changeset
4943 gtk_box_pack_start(GTK_BOX(gtkconv->infopane_hbox), sizing_vbox, FALSE, FALSE, 0);
1735d1c88d4e Insert an empty widget in chat windows to ensure that the infopane is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26986
diff changeset
4944 gtk_widget_show(sizing_vbox);
1735d1c88d4e Insert an empty widget in chat windows to ensure that the infopane is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26986
diff changeset
4945 }
1735d1c88d4e Insert an empty widget in chat windows to ensure that the infopane is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26986
diff changeset
4946 else {
26986
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
4947 gtkconv->u.im->icon_container = gtk_vbox_new(FALSE, 0);
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
4948
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
4949 if ((buddy = purple_find_buddy(purple_conversation_get_account(conv),
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
4950 purple_conversation_get_name(conv))) != NULL) {
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
4951 PurpleContact *contact = purple_buddy_get_contact(buddy);
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
4952 if (contact) {
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
4953 buddyicon_size = purple_blist_node_get_int((PurpleBlistNode*)contact, "pidgin-infopane-iconsize");
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
4954 }
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
4955 }
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
4956 buddyicon_size = CLAMP(buddyicon_size, BUDDYICON_SIZE_MIN, BUDDYICON_SIZE_MAX);
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
4957 gtk_widget_set_size_request(gtkconv->u.im->icon_container, -1, buddyicon_size);
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
4958
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
4959 gtk_box_pack_start(GTK_BOX(gtkconv->infopane_hbox),
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
4960 gtkconv->u.im->icon_container, FALSE, FALSE, 0);
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
4961
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
4962 gtk_widget_show(gtkconv->u.im->icon_container);
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
4963 }
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
4964
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
4965 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
4966
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
4967 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
4968 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(gtkconv->infopane), rend, FALSE);
26721
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
4969 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(gtkconv->infopane), rend, "stock-id", CONV_ICON_COLUMN, NULL);
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
4970 g_object_set(rend, "xalign", 0.0, "xpad", 6, "ypad", 0,
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
4971 "stock-size", gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL),
d78f1d400d2f Use stock-id where possible, instead of a pixbuf.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26718
diff changeset
4972 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
4973
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
4974 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
4975 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
4976 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
4977 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
4978
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
4979 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
4980
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
4981 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
4982 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
4983 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
4984 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
4985
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
4986 rend = gtk_cell_renderer_pixbuf_new();
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
4987 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
4988 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
4989 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
4990
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4991 /* Setup the gtkimhtml widget */
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4992 frame = pidgin_create_imhtml(FALSE, &gtkconv->imhtml, NULL, &imhtml_sw);
22791
9cbb7c2aba23 This should fix the issue where resizing the entry box resizes the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22785
diff changeset
4993 gtk_widget_set_size_request(gtkconv->imhtml, -1, 0);
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4994 if (chat) {
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4995 GtkWidget *hpaned;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4996
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4997 /* Add the topic */
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4998 setup_chat_topic(gtkconv, vbox);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4999
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
5000 /* Add the gtkimhtml frame */
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
5001 hpaned = gtk_hpaned_new();
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
5002 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
5003 gtk_widget_show(hpaned);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
5004 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
5005
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
5006 /* Now add the userlist */
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
5007 setup_chat_userlist(gtkconv, hpaned);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
5008 } else {
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
5009 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
5010 }
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
5011 gtk_widget_show(frame);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
5012
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
5013 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
5014 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml),TRUE);
27552
50effcb66953 Fix build warning (wrong pointer type or something)
Paul Aurich <paul@darkrain42.org>
parents: 27512
diff changeset
5015 g_object_set_data(G_OBJECT(gtkconv->imhtml), "gtkconv", gtkconv);
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
5016
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
5017 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
5018 &imhtml_sw_hscroll, NULL);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
5019 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
5020 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
5021
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
5022 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
5023 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
5024 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
5025 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
5026 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
5027 G_CALLBACK(refocus_entry_cb), gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5028
29718
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
5029 pidgin_conv_setup_quickfind(gtkconv, vbox);
4135044c6497 Use an unobtrusive search dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29712
diff changeset
5030
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
5031 gtkconv->lower_hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
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
5032 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->lower_hbox, FALSE, FALSE, 0);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5033 gtk_widget_show(gtkconv->lower_hbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5034
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5035 /* 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
5036 frame = pidgin_create_imhtml(TRUE, &gtkconv->entry, &gtkconv->toolbar, NULL);
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
5037 gtk_box_pack_start(GTK_BOX(gtkconv->lower_hbox), frame, TRUE, TRUE, 0);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5038 gtk_widget_show(frame);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5039
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
5040 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
5041 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
5042 purple_account_get_protocol_name(conv->account));
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
5043
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
5044 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
5045 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
5046 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
5047 G_CALLBACK(entry_key_press_cb), gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5048 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
5049 G_CALLBACK(send_cb), gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5050 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
5051 G_CALLBACK(entry_stop_rclick_cb), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5052
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5053 gtkconv->entry_buffer =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5054 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
5055 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
5056
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
5057 if (!chat) {
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
5058 /* 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
5059 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
5060 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
5061 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
5062 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
5063 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
5064 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
5065 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
5066 }
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
5067
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5068 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
5069 G_CALLBACK(resize_imhtml_cb), gtkconv);
22465
77b6ff5bdb07 This should fix the 1px bug. If someone still sees this bug after this change, please let me know.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22437
diff changeset
5070 g_signal_connect_swapped(G_OBJECT(gtkconv->entry), "size-allocate",
22422
361b2e61a219 This fixes some cases of the 1-px height bug.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22326
diff changeset
5071 G_CALLBACK(resize_imhtml_cb), gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5072
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5073 default_formatize(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5074 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
5075 G_CALLBACK(clear_formatting_cb), gtkconv);
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
5076 return vbox;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5077 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5078
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5079 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5080 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
5081 GtkSelectionData *sd, guint info, guint t,
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5082 PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5083 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5084 PurpleConversation *conv = gtkconv->active_conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5085 PidginWindow *win = gtkconv->win;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5086 PurpleConversation *c;
26623
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5087 PurpleAccount *convaccount = purple_conversation_get_account(conv);
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5088 PurpleConnection *gc = purple_account_get_connection(convaccount);
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5089 PurplePluginProtocolInfo *prpl_info = gc ? PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl) : NULL;
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5090
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5091 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
5092 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5093 PurpleBlistNode *n = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5094 PurpleBuddy *b;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5095 PidginConversation *gtkconv = NULL;
26623
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5096 PurpleAccount *buddyaccount;
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5097 const char *buddyname;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5098
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5099 n = *(PurpleBlistNode **)sd->data;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5100
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5101 if (PURPLE_BLIST_NODE_IS_CONTACT(n))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5102 b = purple_contact_get_priority_buddy((PurpleContact*)n);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5103 else if (PURPLE_BLIST_NODE_IS_BUDDY(n))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5104 b = (PurpleBuddy*)n;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5105 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5106 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5107
26623
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5108 buddyaccount = purple_buddy_get_account(b);
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5109 buddyname = purple_buddy_get_name(b);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5110 /*
26623
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5111 * If a buddy is dragged to a chat window of the same protocol,
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5112 * invite him to the chat.
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5113 */
26623
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5114 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT &&
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5115 prpl_info && PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, chat_invite) &&
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5116 strcmp(purple_account_get_protocol_id(convaccount),
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5117 purple_account_get_protocol_id(buddyaccount)) == 0) {
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5118 purple_conv_chat_invite_user(PURPLE_CONV_CHAT(conv), buddyname, NULL, TRUE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5119 } else {
26623
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5120 /*
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5121 * If we already have an open conversation with this buddy, then
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5122 * just move the conv to this window. Otherwise, create a new
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5123 * conv and add it to this window.
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5124 */
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5125 c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddyname, buddyaccount);
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5126 if (c != NULL) {
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5127 PidginWindow *oldwin;
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5128 gtkconv = PIDGIN_CONVERSATION(c);
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5129 oldwin = gtkconv->win;
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5130 if (oldwin != win) {
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5131 pidgin_conv_window_remove_gtkconv(oldwin, gtkconv);
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5132 pidgin_conv_window_add_gtkconv(win, gtkconv);
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5133 }
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5134 } else {
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5135 c = purple_conversation_new(PURPLE_CONV_TYPE_IM, buddyaccount, buddyname);
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5136 gtkconv = PIDGIN_CONVERSATION(c);
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5137 if (gtkconv->win != win) {
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5138 pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv);
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5139 pidgin_conv_window_add_gtkconv(win, gtkconv);
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5140 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5141 }
26623
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5142
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5143 /* Make this conversation the active conversation */
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5144 pidgin_conv_window_switch_gtkconv(win, gtkconv);
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5145 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5146
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5147 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
5148 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5149 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
5150 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5151 char *protocol = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5152 char *username = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5153 PurpleAccount *account;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5154 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5155
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5156 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
5157 &protocol, &username, NULL))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5158 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5159 if (account == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5160 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5161 purple_notify_error(win, NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5162 _("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
5163 "can add that buddy."), NULL);
26623
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5164 } else {
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5165 /*
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5166 * If a buddy is dragged to a chat window of the same protocol,
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5167 * invite him to the chat.
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5168 */
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5169 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT &&
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5170 prpl_info && PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, chat_invite) &&
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5171 strcmp(purple_account_get_protocol_id(convaccount), protocol) == 0) {
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5172 purple_conv_chat_invite_user(PURPLE_CONV_CHAT(conv), username, NULL, TRUE);
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5173 } else {
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5174 c = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, username);
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5175 gtkconv = PIDGIN_CONVERSATION(c);
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5176 if (gtkconv->win != win) {
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5177 pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv);
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5178 pidgin_conv_window_add_gtkconv(win, gtkconv);
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5179 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5180 }
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5184 g_free(username);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5185 g_free(protocol);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5186
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5187 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
5188 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5189 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
5190 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM)
26623
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
5191 pidgin_dnd_file_manage(sd, convaccount, purple_conversation_get_name(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5192 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
5193 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5194 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5195 gtk_drag_finish(dc, FALSE, FALSE, t);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5196 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5197
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5198
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5199 static const GtkTargetEntry te[] =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5200 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5201 GTK_IMHTML_DND_TARGETS,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5202 {"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
5203 {"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
5204 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5205
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5206 static PidginConversation *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5207 pidgin_conv_find_gtkconv(PurpleConversation * conv)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5208 {
25318
0e08c847517d Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents: 24292
diff changeset
5209 PurpleBuddy *bud = purple_find_buddy(conv->account, conv->name);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5210 PurpleContact *c;
25318
0e08c847517d Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents: 24292
diff changeset
5211 PurpleBlistNode *cn, *bn;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5212
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5213 if (!bud)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5214 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5215
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5216 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
5217 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5218
25318
0e08c847517d Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents: 24292
diff changeset
5219 cn = PURPLE_BLIST_NODE(c);
0e08c847517d Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents: 24292
diff changeset
5220 for (bn = purple_blist_node_get_first_child(cn); bn; bn = purple_blist_node_get_sibling_next(bn)) {
0e08c847517d Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents: 24292
diff changeset
5221 PurpleBuddy *b = PURPLE_BUDDY(bn);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5222 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5223 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
5224 if (conv->ui_data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5225 return conv->ui_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5226 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5227 }
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 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5230 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5231
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5232 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5233 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
5234 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5235 GList *list;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5236
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5237 g_return_if_fail(bnode);
26878
0924698e2362 Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents: 26727
diff changeset
5238 if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode))
0924698e2362 Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents: 26727
diff changeset
5239 return;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5240
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5241 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
5242 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5243 PidginWindow *win = list->data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5244 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
5245
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5246 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
5247 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5248
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
5249 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
5250 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5251 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5252
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
5253 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
5254 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
5255 {
b079dad9d569 Stop propagating a middle-click on the pane-handle to the notebook below.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17107
diff changeset
5256 /* 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
5257 * 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
5258 * 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
5259 */
b079dad9d569 Stop propagating a middle-click on the pane-handle to the notebook below.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17107
diff changeset
5260 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
5261 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
5262 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
5263 }
b079dad9d569 Stop propagating a middle-click on the pane-handle to the notebook below.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17107
diff changeset
5264
22612
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5265 static void set_typing_font(GtkWidget *widget, GtkStyle *style, PidginConversation *gtkconv)
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5266 {
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5267 static PangoFontDescription *font_desc = NULL;
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5268 static GdkColor *color = NULL;
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5269 static gboolean enable = TRUE;
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5270
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5271 if (font_desc == NULL) {
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5272 char *string = NULL;
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5273 gtk_widget_style_get(widget,
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5274 "typing-notification-font", &string,
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5275 "typing-notification-color", &color,
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5276 "typing-notification-enable", &enable,
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5277 NULL);
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5278 font_desc = pango_font_description_from_string(string);
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5279 g_free(string);
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5280 if (color == NULL) {
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5281 GdkColor def = {0, 0x8888, 0x8888, 0x8888};
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5282 color = gdk_color_copy(&def);
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5283 }
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5284 }
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5285
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5286 gtk_text_buffer_create_tag(GTK_IMHTML(widget)->text_buffer, "TYPING-NOTIFICATION",
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5287 "foreground-gdk", color,
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5288 "font-desc", font_desc,
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5289 NULL);
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5290
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5291 if (!enable) {
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5292 g_object_set_data(G_OBJECT(widget), "disable-typing-notification", GINT_TO_POINTER(TRUE));
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5293 /* or may be 'gtkconv->disable_typing = TRUE;' instead? */
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5294 }
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5295
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5296 g_signal_handlers_disconnect_by_func(G_OBJECT(widget), set_typing_font, gtkconv);
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5297 }
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5298
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5299 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5300 * Conversation UI operations
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5301 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5302 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5303 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
5304 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5305 PidginConversation *gtkconv;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5306 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
5307 GtkWidget *pane = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5308 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
5309 PurpleBlistNode *convnode;
22009
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
5310 PurpleValue *value;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5311
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5312 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
5313 conv->ui_data = gtkconv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5314 if (!g_list_find(gtkconv->convs, conv))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5315 gtkconv->convs = g_list_prepend(gtkconv->convs, conv);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
5316 pidgin_conv_switch_active_conversation(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5317 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5318 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5319
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5320 gtkconv = g_new0(PidginConversation, 1);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5321 conv->ui_data = gtkconv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5322 gtkconv->active_conv = conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5323 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
5324 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
5325
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5326 /* Setup some initial variables. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5327 gtkconv->tooltips = gtk_tooltips_new();
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
5328 gtkconv->unseen_state = PIDGIN_UNSEEN_NONE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5329 gtkconv->unseen_count = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5330
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5331 if (conv_type == PURPLE_CONV_TYPE_IM) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5332 gtkconv->u.im = g_malloc0(sizeof(PidginImPane));
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5333 } 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
5334 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
5335 }
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
5336 pane = setup_common_pane(gtkconv);
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 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
5339 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
5340
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5341 if (pane == NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5342 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
5343 g_free(gtkconv->u.chat);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5344 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
5345 g_free(gtkconv->u.im);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5346
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5347 g_free(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5348 conv->ui_data = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5349 return;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5352 /* Setup drag-and-drop */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5353 gtk_drag_dest_set(pane,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5354 GTK_DEST_DEFAULT_MOTION |
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5355 GTK_DEST_DEFAULT_DROP,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5356 te, sizeof(te) / sizeof(GtkTargetEntry),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5357 GDK_ACTION_COPY);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5358 gtk_drag_dest_set(pane,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5359 GTK_DEST_DEFAULT_MOTION |
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5360 GTK_DEST_DEFAULT_DROP,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5361 te, sizeof(te) / sizeof(GtkTargetEntry),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5362 GDK_ACTION_COPY);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5363 gtk_drag_dest_set(gtkconv->imhtml, 0,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5364 te, sizeof(te) / sizeof(GtkTargetEntry),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5365 GDK_ACTION_COPY);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5366
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5367 gtk_drag_dest_set(gtkconv->entry, 0,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5368 te, sizeof(te) / sizeof(GtkTargetEntry),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5369 GDK_ACTION_COPY);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5370
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
5371 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
5372 G_CALLBACK(ignore_middle_click), NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5373 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
5374 G_CALLBACK(conv_dnd_recv), gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5375 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
5376 G_CALLBACK(conv_dnd_recv), gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5377 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
5378 G_CALLBACK(conv_dnd_recv), gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5379
22612
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5380 g_signal_connect(gtkconv->imhtml, "style-set", G_CALLBACK(set_typing_font), gtkconv);
21875
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
5381
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5382 /* Setup the container for the tab. */
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
5383 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
5384 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
5385 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
5386 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
5387 gtk_widget_show(pane);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5388
19980
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
5389 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
5390 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
5391 gtkconv->make_sound = TRUE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5392
22009
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
5393 if (convnode != NULL &&
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
5394 (value = g_hash_table_lookup(convnode->settings, "enable-logging")) &&
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
5395 purple_value_get_type(value) == PURPLE_TYPE_BOOLEAN)
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
5396 {
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
5397 purple_conversation_set_logging(conv, purple_value_get_boolean(value));
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
5398 }
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
5399
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
5400 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
5401 gtk_widget_show(gtkconv->toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5402 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5403 gtk_widget_hide(gtkconv->toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5404
18602
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
5405 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
5406 gtk_widget_show(gtkconv->infopane_hbox);
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
5407 else
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
5408 gtk_widget_hide(gtkconv->infopane_hbox);
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
5409
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5410 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
5411 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
5412 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
5413 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
5414
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5415 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
5416 G_CALLBACK(gtk_widget_grab_focus),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5417 gtkconv->entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5418
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5419 if (hidden)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5420 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
5421 else
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
5422 pidgin_conv_placement_place(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5423
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5424 if (nick_colors == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5425 nbr_nick_colors = NUM_NICK_COLORS;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5426 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
5427 }
22874
02eda4bd2b22 Apply the custom smiley patches from #1187, from Jorge Villase«Ðo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22287
diff changeset
5428
23197
d54bc04bfd31 Do not show custom smileys where the prpl doesn't support them. Thanks
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23184
diff changeset
5429 if (conv->features & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY)
d54bc04bfd31 Do not show custom smileys where the prpl doesn't support them. Thanks
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23184
diff changeset
5430 pidgin_themes_smiley_themeize_custom(gtkconv->entry);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5431 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5432
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5433 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5434 pidgin_conv_new_hidden(PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5435 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5436 private_gtkconv_new(conv, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5437 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5438
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5439 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5440 pidgin_conv_new(PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5441 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5442 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
5443 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
5444 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
5445 "conversation-displayed", PIDGIN_CONVERSATION(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5446 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5447
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5448 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5449 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
5450 PurpleConversation *conv, PurpleMessageFlags flags)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5451 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5452 PurpleConversationUiOps *ui_ops = pidgin_conversations_get_conv_ui_ops();
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5453 gboolean hide = FALSE;
28200
6f27b4d8c1c3 gtkconv: Remove the close-timer when a new message comes in. Fixes #8512.
Paul Aurich <paul@darkrain42.org>
parents: 28195
diff changeset
5454 guint timer;
19897
922960f829f9 disapproval of revision '08f542359200866bb7a302653d875cdeccb8df01'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
5455
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5456 /* 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
5457 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
5458 hide = TRUE;
19897
922960f829f9 disapproval of revision '08f542359200866bb7a302653d875cdeccb8df01'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
5459
922960f829f9 disapproval of revision '08f542359200866bb7a302653d875cdeccb8df01'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
5460 /* 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
5461 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
5462 !purple_status_is_available(purple_account_get_active_status(account)))
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5463 hide = TRUE;
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5464
21772
21371ea85970 Fix boldifying the chat entries in the buddylist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21766
diff changeset
5465 if (conv && PIDGIN_IS_PIDGIN_CONVERSATION(conv) && !hide) {
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5466 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5467 if (gtkconv->win == hidden_convwin) {
23998
ac3db6ba7078 Fix the conversation window closing unexpectedly. Again.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23994
diff changeset
5468 pidgin_conv_attach_to_conversation(gtkconv->active_conv);
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5469 }
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5470 return;
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5471 }
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5472
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5473 if (hide) {
19897
922960f829f9 disapproval of revision '08f542359200866bb7a302653d875cdeccb8df01'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
5474 ui_ops->create_conversation = pidgin_conv_new_hidden;
922960f829f9 disapproval of revision '08f542359200866bb7a302653d875cdeccb8df01'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
5475 purple_conversation_new(PURPLE_CONV_TYPE_IM, account, sender);
922960f829f9 disapproval of revision '08f542359200866bb7a302653d875cdeccb8df01'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
5476 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
5477 }
28200
6f27b4d8c1c3 gtkconv: Remove the close-timer when a new message comes in. Fixes #8512.
Paul Aurich <paul@darkrain42.org>
parents: 28195
diff changeset
5478
6f27b4d8c1c3 gtkconv: Remove the close-timer when a new message comes in. Fixes #8512.
Paul Aurich <paul@darkrain42.org>
parents: 28195
diff changeset
5479 /* Somebody wants to keep this conversation around, so don't time it out */
29210
0b48f58e8c50 Don't try to remove a timeout on a NULL conversation, which can happen when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29051
diff changeset
5480 if (conv) {
0b48f58e8c50 Don't try to remove a timeout on a NULL conversation, which can happen when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29051
diff changeset
5481 timer = GPOINTER_TO_INT(purple_conversation_get_data(conv, "close-timer"));
0b48f58e8c50 Don't try to remove a timeout on a NULL conversation, which can happen when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29051
diff changeset
5482 if (timer) {
0b48f58e8c50 Don't try to remove a timeout on a NULL conversation, which can happen when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29051
diff changeset
5483 purple_timeout_remove(timer);
0b48f58e8c50 Don't try to remove a timeout on a NULL conversation, which can happen when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29051
diff changeset
5484 purple_conversation_set_data(conv, "close-timer", GINT_TO_POINTER(0));
0b48f58e8c50 Don't try to remove a timeout on a NULL conversation, which can happen when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29051
diff changeset
5485 }
28200
6f27b4d8c1c3 gtkconv: Remove the close-timer when a new message comes in. Fixes #8512.
Paul Aurich <paul@darkrain42.org>
parents: 28195
diff changeset
5486 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5487 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5488
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5489 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5490 pidgin_conv_destroy(PurpleConversation *conv)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5491 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5492 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5493
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5494 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
5495 /* 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
5496 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
5497 /* 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
5498 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
5499 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
5500 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
5501 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5502 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
5503 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5504
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5505 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
5506
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5507 /* 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
5508 purple_request_close_with_handle(gtkconv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5509 purple_notify_close_with_handle(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5510
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5511 gtk_widget_destroy(gtkconv->tab_cont);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5512 g_object_unref(gtkconv->tab_cont);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5513
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5514 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
5515 if (gtkconv->u.im->icon_timer != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5516 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
5517
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5518 if (gtkconv->u.im->anim != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5519 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
5520
16273
143b508024c0 Patch from khc to remove the typing notifcation callback when the window is
Stu Tomlinson <stu@nosnilmot.com>
parents: 16229
diff changeset
5521 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
5522 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
5523
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5524 g_free(gtkconv->u.im);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5525 } 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
5526 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
5527 g_free(gtkconv->u.chat);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5528 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5529
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5530 gtk_object_sink(GTK_OBJECT(gtkconv->tooltips));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5531
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5532 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
5533 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
5534 g_list_free(gtkconv->send_history);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5535
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
5536 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
5537 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
5538 }
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
5539
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5540 g_free(gtkconv);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5543
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5544 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5545 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
5546 const char *message, PurpleMessageFlags flags,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5547 time_t mtime)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5548 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5549 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5550
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5551 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5552
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5553 if (conv != gtkconv->active_conv &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5554 flags & PURPLE_MESSAGE_ACTIVE_ONLY)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5555 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5556 /* 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
5557 * 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
5558 * before being written to the log. */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5559 purple_debug_info("gtkconv",
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
5560 "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
5561 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5562 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5563
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5564 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
5565 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5566
24267
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5567 static const char *
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5568 get_text_tag_color(GtkTextTag *tag)
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5569 {
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5570 GdkColor *color = NULL;
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5571 gboolean set = FALSE;
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5572 static char colcode[] = "#XXXXXX";
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5573 if (tag)
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5574 g_object_get(G_OBJECT(tag), "foreground-set", &set, "foreground-gdk", &color, NULL);
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5575 if (set && color)
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5576 g_snprintf(colcode, sizeof(colcode), "#%02x%02x%02x",
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5577 color->red >> 8, color->green >> 8, color->blue >> 8);
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5578 else
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5579 colcode[0] = '\0';
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5580 if (color)
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5581 gdk_color_free(color);
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5582 return colcode;
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5583 }
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5584
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5585 /* 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
5586 static gboolean buddytag_event(GtkTextTag *tag, GObject *imhtml,
24267
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5587 GdkEvent *event, GtkTextIter *arg2, gpointer data)
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5588 {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5589 if (event->type == GDK_BUTTON_PRESS
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5590 || event->type == GDK_2BUTTON_PRESS) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5591 GdkEventButton *btn_event = (GdkEventButton*) event;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5592 PurpleConversation *conv = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5593 char *buddyname;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5594
24267
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5595 /* strlen("BUDDY " or "HILIT ") == 6 */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5596 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
5597 && (strlen(tag->name) > 6), FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5598
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5599 buddyname = (tag->name) + 6;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5600
29378
fdb61f7e8576 Change the cursor and act on double click on usernames in chat history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29358
diff changeset
5601 if (btn_event->button == 1 &&
fdb61f7e8576 Change the cursor and act on double click on usernames in chat history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29358
diff changeset
5602 event->type == GDK_2BUTTON_PRESS) {
fdb61f7e8576 Change the cursor and act on double click on usernames in chat history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29358
diff changeset
5603 chat_do_im(PIDGIN_CONVERSATION(conv), buddyname);
fdb61f7e8576 Change the cursor and act on double click on usernames in chat history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29358
diff changeset
5604 return TRUE;
fdb61f7e8576 Change the cursor and act on double click on usernames in chat history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29358
diff changeset
5605 } else if (btn_event->button == 2
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5606 && event->type == GDK_2BUTTON_PRESS) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5607 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
5608
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5609 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5610 } else if (btn_event->button == 3
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5611 && event->type == GDK_BUTTON_PRESS) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5612 GtkTextIter start, end;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5613
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5614 /* we shouldn't display the popup
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5615 * if the user has selected something: */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5616 if (!gtk_text_buffer_get_selection_bounds(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5617 gtk_text_iter_get_buffer(arg2),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5618 &start, &end)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5619 GtkWidget *menu = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5620 PurpleConnection *gc =
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5621 purple_conversation_get_gc(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5622
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5623
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5624 menu = create_chat_menu(conv, buddyname, gc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5625 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
5626 NULL, GTK_WIDGET(imhtml),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5627 btn_event->button,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5628 btn_event->time);
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 /* Don't propagate the event any further */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5631 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5632 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5633 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5634 }
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 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5637 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5638
24267
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5639 static GtkTextTag *get_buddy_tag(PurpleConversation *conv, const char *who, PurpleMessageFlags flag,
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5640 gboolean create)
23005
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
5641 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5642 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5643 GtkTextTag *buddytag;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5644 gchar *str;
24267
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5645 gboolean highlight = (flag & PURPLE_MESSAGE_NICK);
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5646 GtkTextBuffer *buffer = GTK_IMHTML(gtkconv->imhtml)->text_buffer;
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5647
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5648 str = g_strdup_printf(highlight ? "HILIT %s" : "BUDDY %s", who);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5649
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5650 buddytag = gtk_text_tag_table_lookup(
24267
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5651 gtk_text_buffer_get_tag_table(buffer), str);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5652
23005
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
5653 if (buddytag == NULL && create) {
24267
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5654 if (highlight)
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5655 buddytag = gtk_text_buffer_create_tag(buffer, str,
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5656 "foreground", get_text_tag_color(gtk_text_tag_table_lookup(
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5657 gtk_text_buffer_get_tag_table(buffer), "highlight-name")),
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5658 "weight", PANGO_WEIGHT_BOLD,
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5659 NULL);
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5660 else
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5661 buddytag = gtk_text_buffer_create_tag(
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5662 buffer, str,
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5663 "foreground-gdk", get_nick_color(gtkconv, who),
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5664 "weight", purple_find_buddy(purple_conversation_get_account(conv), who) ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL,
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5665 NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5666
29378
fdb61f7e8576 Change the cursor and act on double click on usernames in chat history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29358
diff changeset
5667 g_object_set_data(G_OBJECT(buddytag), "cursor", "");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5668 g_signal_connect(G_OBJECT(buddytag), "event",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5669 G_CALLBACK(buddytag_event), conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5670 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5671
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5672 g_free(str);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5673
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5674 return buddytag;
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
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
5677 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
5678 {
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5679 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
5680
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5681 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
5682 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
5683
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5684 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
5685 }
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5686
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25362
diff changeset
5687 /* Detect string direction and encapsulate the string in RLE/LRE/PDF unicode characters
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5688 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
5689 static void
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5690 str_embed_direction_chars(char **str)
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5691 {
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
5692 #ifdef HAVE_PANGO14
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5693 char pre_str[4];
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5694 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
5695 char *ret;
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5696
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5697 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
5698 {
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
5699 sprintf(pre_str, "%c%c%c",
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5700 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
5701 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
5702 0xE2, 0x80, 0xAC, /* PDF */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5703 0xE2, 0x80, 0x8E, /* LRM */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5704 0xE2, 0x80, 0xAC); /* PDF */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5705 }
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5706 else
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5707 {
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
5708 sprintf(pre_str, "%c%c%c",
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5709 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
5710 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
5711 0xE2, 0x80, 0xAC, /* PDF */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5712 0xE2, 0x80, 0x8F, /* RLM */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5713 0xE2, 0x80, 0xAC); /* PDF */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5714 }
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5715
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
5716 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
5717
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5718 g_free(*str);
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5719 *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
5720 #endif
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5721 }
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5722
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5723 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5724 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
5725 const char *message, PurpleMessageFlags flags,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5726 time_t mtime)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5727 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5728 PidginConversation *gtkconv;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5729 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5730 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5731 int gtk_font_options = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5732 int gtk_font_options_all = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5733 int max_scrollback_lines;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5734 int line_count;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5735 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
5736 gboolean show_date;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5737 char *mdate;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5738 char *str;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5739 char *with_font_tag;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5740 char *sml_attrib = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5741 size_t length;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5742 PurpleConversationType type;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5743 char *displaying;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5744 gboolean plugin_return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5745 char *bracket;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5746 int tag_count = 0;
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5747 gboolean is_rtl_message = FALSE;
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
5748
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5749 g_return_if_fail(conv != NULL);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5750 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5751 g_return_if_fail(gtkconv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5752
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
5753 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
5754 /* 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
5755 * 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
5756 * 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
5757 * 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
5758 */
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
5759 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
5760 }
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
5761
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5762 if (conv != gtkconv->active_conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5763 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5764 if (flags & PURPLE_MESSAGE_ACTIVE_ONLY)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5765 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5766 /* 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
5767 * 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
5768 * 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
5769 * purple_conversation_write(). */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5770 purple_debug_info("gtkconv",
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
5771 "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
5772 return;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5775 /* 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
5776 /* 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
5777 if (flags & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV))
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
5778 pidgin_conv_switch_active_conversation(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5779 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5780
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5781 type = purple_conversation_get_type(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5782 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5783 g_return_if_fail(account != NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5784 gc = purple_account_get_connection(account);
22645
f75509f776cc When you try to execute a command (e.g., /part etc.) in a chat on a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22626
diff changeset
5785 g_return_if_fail(gc != NULL || !(flags & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV)));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5786
15579
74b945e7609c Moved linkification of incoming messages to pidgin_conv_write_conv()
Evan Schoenberg <evan.s@dreskin.net>
parents: 15560
diff changeset
5787 /* 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
5788 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
5789 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
5790 else
7790021b1270 add a PURPLE_MESSAGE_NO_LINKIFY to prevent things from getting linkified
Nathan Walp <nwalp@pidgin.im>
parents: 18024
diff changeset
5791 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
5792
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5793 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
5794 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
5795 "displaying-im-msg" : "displaying-chat-msg"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5796 account, name, &displaying, conv, flags));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5797 if (plugin_return)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5798 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5799 g_free(displaying);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5800 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5801 }
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5802 length = strlen(displaying) + 1;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5803
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5804 /* 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
5805 * 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
5806 * needs that much formatting, anyway.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5807 */
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5808 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
5809 tag_count++;
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5810
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5811 if (tag_count > 100) {
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5812 char *tmp = displaying;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5813 displaying = purple_markup_strip_html(tmp);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5814 g_free(tmp);
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5815 }
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5816
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5817 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
5818 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
5819 gtkconv->imhtml)));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5820
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5821 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
5822 PIDGIN_PREFS_ROOT "/conversations/scrollback_lines");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5823 /* 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
5824 max scrollback, trim down to max scrollback */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5825 if (max_scrollback_lines > 0
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5826 && line_count > (max_scrollback_lines + 100)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5827 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
5828 GTK_TEXT_VIEW(gtkconv->imhtml));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5829 GtkTextIter start, end;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5830
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5831 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
5832 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
5833 (line_count - max_scrollback_lines));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5834 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
5835 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5836
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5837 if (type == PURPLE_CONV_TYPE_CHAT)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5838 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5839 /* Create anchor for user */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5840 GtkTextIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5841 char *tmp = g_strconcat("user:", name, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5842
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5843 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
5844 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
5845 tmp, &iter, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5846 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5847 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5848
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
5849 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
5850 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
5851
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5852 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
5853 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
5854
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
5855 /* 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
5856 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
5857 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
5858
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5859 /* 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
5860 * 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
5861 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
5862
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5863 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
5864 "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
5865 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
5866
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5867 if (mdate == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5868 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5869 struct tm *tm = localtime(&mtime);
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5870 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
5871 if (show_date)
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5872 tmp = purple_date_format_long(tm);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5873 else
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5874 tmp = purple_time_format(tm);
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5875 mdate = g_strdup_printf("(%s)", tmp);
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5876 }
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5877
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5878 /* Bi-Directional support - set timestamp direction using unicode characters */
27094
af4a4ebc6441 Add a utlity function purple_markup_is_rtl
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26998
diff changeset
5879 is_rtl_message = purple_markup_is_rtl(message);
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5880 /* Enforce direction only if message is RTL - doesn't effect LTR users */
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5881 if (is_rtl_message)
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5882 str_embed_direction_chars(&mdate);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5883
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
5884 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
5885 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
5886
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5887 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
5888
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5889 gtk_font_options |= GTK_IMHTML_NO_COMMENTS;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5890
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5891 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
5892 !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
5893 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
5894
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5895 /* 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
5896 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
5897 OPT_PROTO_USE_POINTSIZE) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5898 gtk_font_options |= GTK_IMHTML_USE_POINTSIZE;
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
23197
d54bc04bfd31 Do not show custom smileys where the prpl doesn't support them. Thanks
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23184
diff changeset
5901 if (!(flags & PURPLE_MESSAGE_RECV) && (conv->features & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY))
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
5902 {
22874
02eda4bd2b22 Apply the custom smiley patches from #1187, from Jorge Villase«Ðo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22287
diff changeset
5903 /* We want to see our own smileys. Need to revert it after send*/
02eda4bd2b22 Apply the custom smiley patches from #1187, from Jorge Villase«Ðo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22287
diff changeset
5904 pidgin_themes_smiley_themeize_custom(gtkconv->imhtml);
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
5905 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5906
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5907 /* 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
5908 if (flags & PURPLE_MESSAGE_RAW) {
15602
b03021cef5cb SF Patch #1653845 from Matt Perry
Richard Laager <rlaager@wiktel.com>
parents: 15579
diff changeset
5909 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
5910 } else if (flags & PURPLE_MESSAGE_SYSTEM) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5911 g_snprintf(buf2, sizeof(buf2),
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5912 "<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
5913 sml_attrib ? sml_attrib : "", mdate, displaying);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5914
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5915 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
5916
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5917 } else if (flags & PURPLE_MESSAGE_ERROR) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5918 g_snprintf(buf2, sizeof(buf2),
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5919 "<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
5920 sml_attrib ? sml_attrib : "", mdate, displaying);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5921
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5922 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
5923
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5924 } 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
5925 g_snprintf(buf2, BUF_LONG,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5926 "<B><FONT %s COLOR=\"#777777\">%s</FONT></B>",
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5927 sml_attrib ? sml_attrib : "", displaying);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5928
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5929 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
5930 } else {
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5931 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
5932 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
5933 /* The initial offset is to deal with
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5934 * escaped entities making the string longer */
23168
e01b5aa9fc7b Fix the offset for coloring nicknames, especially for auto-replies, and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23161
diff changeset
5935 int tag_start_offset = 0;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5936 int tag_end_offset = 0;
23005
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
5937 const char *tagname = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5938
23168
e01b5aa9fc7b Fix the offset for coloring nicknames, especially for auto-replies, and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23161
diff changeset
5939 GtkTextIter start, end;
23169
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
5940 GtkTextMark *mark;
23168
e01b5aa9fc7b Fix the offset for coloring nicknames, especially for auto-replies, and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23161
diff changeset
5941 GtkTextTag *tag;
e01b5aa9fc7b Fix the offset for coloring nicknames, especially for auto-replies, and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23161
diff changeset
5942 GtkTextBuffer *buffer = GTK_IMHTML(gtkconv->imhtml)->text_buffer;
e01b5aa9fc7b Fix the offset for coloring nicknames, especially for auto-replies, and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23161
diff changeset
5943
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5944 /* Enforce direction on alias */
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5945 if (is_rtl_message)
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5946 str_embed_direction_chars(&alias_escaped);
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5947
23005
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
5948 str = g_malloc(1024);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5949 if (flags & PURPLE_MESSAGE_WHISPER) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5950 /* 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
5951 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
5952 g_snprintf(str, 1024, "***%s", alias_escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5953 tag_start_offset += 3;
23005
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
5954 tagname = "whisper-action-name";
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5955 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5956 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5957 g_snprintf(str, 1024, "*%s*:", alias_escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5958 tag_start_offset += 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5959 tag_end_offset = 2;
23005
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
5960 tagname = "whisper-name";
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5961 }
23005
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
5962 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5963 if (purple_message_meify(new_message, -1)) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5964 if (flags & PURPLE_MESSAGE_AUTO_RESP) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5965 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, alias_escaped);
23168
e01b5aa9fc7b Fix the offset for coloring nicknames, especially for auto-replies, and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23161
diff changeset
5966 tag_start_offset += strlen(AUTO_RESPONSE) - 6 + 4;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5967 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5968 g_snprintf(str, 1024, "***%s", alias_escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5969 tag_start_offset += 3;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5970 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5971
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5972 if (flags & PURPLE_MESSAGE_NICK)
23005
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
5973 tagname = "highlight-name";
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5974 else
23005
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
5975 tagname = "action-name";
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
5976 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5977 if (flags & PURPLE_MESSAGE_AUTO_RESP) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5978 g_snprintf(str, 1024, "%s %s", alias_escaped, AUTO_RESPONSE);
23168
e01b5aa9fc7b Fix the offset for coloring nicknames, especially for auto-replies, and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23161
diff changeset
5979 tag_start_offset += strlen(AUTO_RESPONSE) - 6 + 1;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5980 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5981 g_snprintf(str, 1024, "%s:", alias_escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5982 tag_end_offset = 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5983 }
23005
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
5984
21840
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5985 if (flags & PURPLE_MESSAGE_NICK) {
24267
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5986 if (type == PURPLE_CONV_TYPE_IM) {
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5987 tagname = "highlight-name";
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
5988 }
23005
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
5989 } else if (flags & PURPLE_MESSAGE_RECV) {
23007
3c78771b520a Clarify a comment.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23005
diff changeset
5990 /* The tagname for chats is handled by get_buddy_tag */
23005
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
5991 if (type == PURPLE_CONV_TYPE_IM) {
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
5992 tagname = "receive-name";
21840
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5993 }
23005
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
5994 } else if (flags & PURPLE_MESSAGE_SEND) {
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
5995 tagname = "send-name";
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
5996 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5997 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
5998 }
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6001
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6002 g_free(alias_escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6003
23168
e01b5aa9fc7b Fix the offset for coloring nicknames, especially for auto-replies, and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23161
diff changeset
6004 if (tagname)
e01b5aa9fc7b Fix the offset for coloring nicknames, especially for auto-replies, and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23161
diff changeset
6005 tag = gtk_text_tag_table_lookup(gtk_text_buffer_get_tag_table(buffer), tagname);
e01b5aa9fc7b Fix the offset for coloring nicknames, especially for auto-replies, and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23161
diff changeset
6006 else
24267
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
6007 tag = get_buddy_tag(conv, name, flags, TRUE);
23168
e01b5aa9fc7b Fix the offset for coloring nicknames, especially for auto-replies, and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23161
diff changeset
6008
23169
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
6009 if (GTK_IMHTML(gtkconv->imhtml)->show_comments) {
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
6010 /* The color for the timestamp has to be set in the font-tags, unfortunately.
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
6011 * Applying the nick-tag to timestamps would work, but that can make it
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
6012 * bold. I thought applying the "comment" tag again, which has "weight" set
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
6013 * to PANGO_WEIGHT_NORMAL, would remove the boldness. But it doesn't. So
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
6014 * this will have to do. I don't terribly like it. -- sadrul */
24267
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
6015 const char *color = get_text_tag_color(tag);
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
6016 g_snprintf(buf2, BUF_LONG, "<FONT %s%s%s SIZE=\"2\"><!--%s --></FONT>",
ea5909557bc5 Fix a bug where right-clicking the user's name in a chat conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23998
diff changeset
6017 color ? "COLOR=\"" : "", color ? color : "", color ? "\"" : "", mdate);
23169
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
6018 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all | GTK_IMHTML_NO_SCROLL);
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
6019 }
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
6020
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
6021 gtk_text_buffer_get_end_iter(buffer, &end);
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
6022 mark = gtk_text_buffer_create_mark(buffer, NULL, &end, TRUE);
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
6023
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
6024 g_snprintf(buf2, BUF_LONG, "<FONT %s>%s</FONT> ", sml_attrib ? sml_attrib : "", str);
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
6025 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all | GTK_IMHTML_NO_SCROLL);
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
6026
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
6027 gtk_text_buffer_get_end_iter(buffer, &end);
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
6028 gtk_text_buffer_get_iter_at_mark(buffer, &start, mark);
23168
e01b5aa9fc7b Fix the offset for coloring nicknames, especially for auto-replies, and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23161
diff changeset
6029 gtk_text_buffer_apply_tag(buffer, tag, &start, &end);
23169
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
6030 gtk_text_buffer_delete_mark(buffer, mark);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6031
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6032 g_free(str);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6033
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6034 if(gc){
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6035 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
6036 char *post = "</font>";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6037 int pre_len = strlen(pre);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6038 int post_len = strlen(post);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6039
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6040 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
6041
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6042 strcpy(with_font_tag, pre);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6043 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
6044 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
6045
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6046 length += pre_len + post_len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6047 g_free(pre);
23005
f11fc3fb5b8c Use text-tags to set the weight/color of the nick in conversations. This
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22844
diff changeset
6048 } else
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6049 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
6050
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6051 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
6052 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
6053
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6054 g_free(with_font_tag);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6055 g_free(new_message);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6056 }
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 g_free(mdate);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6059 g_free(sml_attrib);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6060
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6061 /* Tab highlighting stuff */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6062 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
6063 {
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
6064 PidginUnseenState unseen = PIDGIN_UNSEEN_NONE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6065
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6066 if ((flags & PURPLE_MESSAGE_NICK) == PURPLE_MESSAGE_NICK)
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
6067 unseen = PIDGIN_UNSEEN_NICK;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6068 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
6069 ((flags & PURPLE_MESSAGE_ERROR) == PURPLE_MESSAGE_ERROR))
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
6070 unseen = PIDGIN_UNSEEN_EVENT;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6071 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
6072 unseen = PIDGIN_UNSEEN_NO_LOG;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6073 else
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
6074 unseen = PIDGIN_UNSEEN_TEXT;
15374
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 gtkconv_set_unseen(gtkconv, unseen);
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
23197
d54bc04bfd31 Do not show custom smileys where the prpl doesn't support them. Thanks
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23184
diff changeset
6079 if (!(flags & PURPLE_MESSAGE_RECV) && (conv->features & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY))
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
6080 {
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
6081 /* Restore the smiley-data */
22874
02eda4bd2b22 Apply the custom smiley patches from #1187, from Jorge Villase«Ðo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22287
diff changeset
6082 pidgin_themes_smiley_themeize(gtkconv->imhtml);
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
6083 }
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
6084
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6085 purple_signal_emit(pidgin_conversations_get_handle(),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6086 (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
6087 account, name, displaying, conv, flags);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6088 g_free(displaying);
21897
a64a7bc69f42 Avoid jumpiness when typing notification in the conv. history is removed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21896
diff changeset
6089 update_typing_message(gtkconv, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6090 }
19559
11849a5c3951 Update the chat topic and userlist when reattaching the Pidgin UI.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19556
diff changeset
6091
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6092 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6093 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
6094 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6095 PurpleConvChat *chat;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6096 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6097 PidginChatPane *gtkchat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6098 GtkListStore *ls;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6099 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6100
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6101 char tmp[BUF_LONG];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6102 int num_users;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6103
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6104 chat = PURPLE_CONV_CHAT(conv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6105 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6106 gtkchat = gtkconv->u.chat;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6107
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
6108 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
6109
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6110 g_snprintf(tmp, sizeof(tmp),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6111 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
6112 num_users),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6113 num_users);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6114
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6115 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
6116
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6117 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
6118
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6119 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
6120 GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6121
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6122 l = cbuddies;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6123 while (l != NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6124 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
6125 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6126 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6127
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6128 /* 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
6129 * 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
6130 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6131 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
6132 GTK_SORT_ASCENDING);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6133 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6134
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6135 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6136 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
6137 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
6138 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6139 PurpleConvChat *chat;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6140 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6141 PidginChatPane *gtkchat;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6142 PurpleConvChatBuddyFlags flags;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6143 PurpleConvChatBuddy *cbuddy;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6144 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6145 GtkTreeModel *model;
26718
9e0001caa207 Italicize nicks in the conversation history for folks leaving a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26623
diff changeset
6146 GtkTextTag *tag;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6147 int f = 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6148
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6149 chat = PURPLE_CONV_CHAT(conv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6150 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6151 gtkchat = gtkconv->u.chat;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6152
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6153 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
6154
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6155 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
6156 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6157
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6158 while (f != 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6159 char *val;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6160
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6161 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
6162
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6163 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
6164 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
6165 g_free(val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6166 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6167 }
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 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
6170
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6171 g_free(val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6172 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6173
26718
9e0001caa207 Italicize nicks in the conversation history for folks leaving a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26623
diff changeset
6174 if ((tag = get_buddy_tag(conv, old_name, 0, FALSE)))
9e0001caa207 Italicize nicks in the conversation history for folks leaving a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26623
diff changeset
6175 g_object_set(G_OBJECT(tag), "style", PANGO_STYLE_ITALIC, NULL);
9e0001caa207 Italicize nicks in the conversation history for folks leaving a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26623
diff changeset
6176 if ((tag = get_buddy_tag(conv, old_name, PURPLE_MESSAGE_NICK, FALSE)))
9e0001caa207 Italicize nicks in the conversation history for folks leaving a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26623
diff changeset
6177 g_object_set(G_OBJECT(tag), "style", PANGO_STYLE_ITALIC, NULL);
9e0001caa207 Italicize nicks in the conversation history for folks leaving a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26623
diff changeset
6178
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6179 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
6180 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6181
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6182 g_return_if_fail(new_alias != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6183
18305
ffd706ec0220 Set and use convchatbuddy->buddy.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18302
diff changeset
6184 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
6185
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6186 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
6187 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6188
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6189 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6190 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
6191 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6192 PurpleConvChat *chat;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6193 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6194 PidginChatPane *gtkchat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6195 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6196 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6197 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6198 char tmp[BUF_LONG];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6199 int num_users;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6200 gboolean f;
26718
9e0001caa207 Italicize nicks in the conversation history for folks leaving a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26623
diff changeset
6201 GtkTextTag *tag;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6202
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6203 chat = PURPLE_CONV_CHAT(conv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6204 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6205 gtkchat = gtkconv->u.chat;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6206
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
6207 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
6208
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6209 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
6210 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
6211
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6212 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
6213 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6214
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6215 do {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6216 char *val;
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 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
6219 CHAT_USERS_NAME_COLUMN, &val, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6220
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6221 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
6222 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
6223 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6224 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6225 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
6226
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6227 g_free(val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6228 } while (f);
26718
9e0001caa207 Italicize nicks in the conversation history for folks leaving a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26623
diff changeset
6229
9e0001caa207 Italicize nicks in the conversation history for folks leaving a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26623
diff changeset
6230 if ((tag = get_buddy_tag(conv, l->data, 0, FALSE)))
9e0001caa207 Italicize nicks in the conversation history for folks leaving a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26623
diff changeset
6231 g_object_set(G_OBJECT(tag), "style", PANGO_STYLE_ITALIC, NULL);
9e0001caa207 Italicize nicks in the conversation history for folks leaving a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26623
diff changeset
6232 if ((tag = get_buddy_tag(conv, l->data, PURPLE_MESSAGE_NICK, FALSE)))
9e0001caa207 Italicize nicks in the conversation history for folks leaving a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26623
diff changeset
6233 g_object_set(G_OBJECT(tag), "style", PANGO_STYLE_ITALIC, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6234 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6235
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6236 g_snprintf(tmp, sizeof(tmp),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6237 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
6238 num_users), num_users);
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 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
6241 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6242
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6243 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6244 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
6245 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6246 PurpleConvChat *chat;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6247 PurpleConvChatBuddy *cbuddy;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6248 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6249 PidginChatPane *gtkchat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6250 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6251 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6252 int f = 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6253 char *alias = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6254
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6255 chat = PURPLE_CONV_CHAT(conv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6256 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6257 gtkchat = gtkconv->u.chat;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6258
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6259 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
6260
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6261 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
6262 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6263
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6264 while (f != 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6265 char *val;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6266
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6267 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
6268
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6269 if (!purple_utf8_strcasecmp(user, val)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6270 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
6271 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
6272 g_free(val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6273 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6274 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6275
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6276 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
6277
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6278 g_free(val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6279 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6280
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6281 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
6282 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6283 g_free(alias);
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 g_return_if_fail(alias != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6288
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
6289 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
6290 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
6291 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
6292 g_free(alias);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6295 gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6296 pidgin_conv_has_focus(PurpleConversation *conv)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6297 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6298 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6299 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6300 gboolean has_focus;
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 win = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6303
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6304 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
6305
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6306 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
6307 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6308
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6309 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6310 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6311
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6312 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6313 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
6314 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6315 GtkIMHtmlSmiley *smiley;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6316
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6317 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
6318
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6319 if (smiley) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6320 if (!(smiley->flags & GTK_IMHTML_SMILEY_CUSTOM)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6321 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6322 }
22889
019052a807a3 Introduce API for GtkIMHtmlSmiley. Use this to prevent leaking remote custom emoticons.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22885
diff changeset
6323 gtk_imhtml_smiley_reload(smiley);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6324 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6325 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6326
22889
019052a807a3 Introduce API for GtkIMHtmlSmiley. Use this to prevent leaking remote custom emoticons.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22885
diff changeset
6327 smiley = gtk_imhtml_smiley_create(NULL, smile, FALSE, GTK_IMHTML_SMILEY_CUSTOM);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6328 gtk_imhtml_associate_smiley(imhtml, sml, smiley);
22889
019052a807a3 Introduce API for GtkIMHtmlSmiley. Use this to prevent leaking remote custom emoticons.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22885
diff changeset
6329 g_signal_connect_swapped(imhtml, "destroy", G_CALLBACK(gtk_imhtml_smiley_destroy), smiley);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6330
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6331 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6332 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6333
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6334 static gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6335 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
6336 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6337 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6338 struct smiley_list *list;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6339 const char *sml = NULL, *conv_sml;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6340
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6341 if (!conv || !smile || !*smile) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6342 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6343 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6344
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6345 /* 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
6346 if (pidgin_themes_smileys_disabled())
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6347 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6348
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6349 /* 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
6350 * 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
6351 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
6352 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6353
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6354 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
6355 if (!strcmp(list->sml, conv_sml)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6356 sml = list->sml;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6357 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6358 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6359 }
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 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
6362 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6363
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6364 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
6365 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
6366 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6367
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6368 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6369 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6370
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6371 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6372 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
6373 const guchar *data, gsize size)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6374 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6375 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6376 GtkIMHtmlSmiley *smiley;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6377 GdkPixbufLoader *loader;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6378 const char *sml;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6379
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6380 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
6381 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6382 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
6383
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6384 if (!smiley)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6385 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6386
26965
655013f05eaa Save raw-data for an image when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26932
diff changeset
6387 smiley->data = g_realloc(smiley->data, smiley->datasize + size);
26998
bf3ad70508f4 Fix a warning.
Paul Aurich <paul@darkrain42.org>
parents: 26993
diff changeset
6388 g_memmove((guchar *)smiley->data + smiley->datasize, data, size);
26965
655013f05eaa Save raw-data for an image when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26932
diff changeset
6389 smiley->datasize += size;
655013f05eaa Save raw-data for an image when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26932
diff changeset
6390
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6391 loader = smiley->loader;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6392 if (!loader)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6393 return;
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 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
6396 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6397
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6398 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6399 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
6400 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6401 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6402 GtkIMHtmlSmiley *smiley;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6403 GdkPixbufLoader *loader;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6404 const char *sml;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6405
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6406 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6407 g_return_if_fail(smile != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6408
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6409 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
6410 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6411 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
6412
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6413 if (!smiley)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6414 return;
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 loader = smiley->loader;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6417
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6418 if (!loader)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6419 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6420
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6421
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6422
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6423 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
6424
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6425 gdk_pixbuf_loader_close(loader, NULL);
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6428
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6429 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6430 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
6431 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6432 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6433
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6434 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
6435 }
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 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6438 * 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
6439 * 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
6440 * account signs on or off.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6441 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6442 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6443 gray_stuff_out(PidginConversation *gtkconv)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6444 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6445 PidginWindow *win;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6446 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6447 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6448 PurplePluginProtocolInfo *prpl_info = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6449 GdkPixbuf *window_icon = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6450 GtkIMHtmlButtons buttons;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6451 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6452
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6453 win = pidgin_conv_get_window(gtkconv);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6454 gc = purple_conversation_get_gc(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6455 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6456
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6457 if (gc != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6458 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
6459
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6460 if (win->menu.send_to != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6461 update_send_to_selection(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6462
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6463 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6464 * 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
6465 * 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
6466 * 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
6467 * 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
6468 * 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
6469 * is sensitive or not.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6470 */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6471 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
6472 /* 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
6473
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6474 /* Deal with menu items */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6475 gtk_widget_show(win->menu.view_log);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6476 gtk_widget_show(win->menu.send_file);
29701
28880022598c Temporary workaround to not break ABI, to allow this in for 2.7.0
Marcus Lundblad <ml@update.uu.se>
parents: 29697
diff changeset
6477 gtk_widget_show(g_object_get_data(G_OBJECT(win->window), "get_attention"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6478 gtk_widget_show(win->menu.add_pounce);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6479 gtk_widget_show(win->menu.get_info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6480 gtk_widget_hide(win->menu.invite);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6481 gtk_widget_show(win->menu.alias);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6482 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
6483 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
6484 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
6485 } 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
6486 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
6487 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
6488 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6489
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6490 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
6491 gtk_widget_show(win->menu.add);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6492 gtk_widget_hide(win->menu.remove);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6493 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6494 gtk_widget_show(win->menu.remove);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6495 gtk_widget_hide(win->menu.add);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6496 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6497
17776
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
6498 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
6499 gtk_widget_show(win->menu.insert_image);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6500 } 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
6501 /* 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
6502
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6503 /* Deal with menu items */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6504 gtk_widget_show(win->menu.view_log);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6505 gtk_widget_hide(win->menu.send_file);
29701
28880022598c Temporary workaround to not break ABI, to allow this in for 2.7.0
Marcus Lundblad <ml@update.uu.se>
parents: 29697
diff changeset
6506 gtk_widget_hide(g_object_get_data(G_OBJECT(win->window), "get_attention"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6507 gtk_widget_hide(win->menu.add_pounce);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6508 gtk_widget_hide(win->menu.get_info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6509 gtk_widget_show(win->menu.invite);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6510 gtk_widget_show(win->menu.alias);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6511 gtk_widget_hide(win->menu.block);
15555
883bf81c8d73 Hide the unblock menuitem for chats.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15465
diff changeset
6512 gtk_widget_hide(win->menu.unblock);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6513
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6514 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
6515 /* 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
6516 gtk_widget_show(win->menu.add);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6517 gtk_widget_hide(win->menu.remove);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6518 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6519 /* 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
6520 gtk_widget_hide(win->menu.add);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6521 gtk_widget_show(win->menu.remove);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6522 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6523
17776
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
6524 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
6525 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
6526 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6527
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6528 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6529 * 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
6530 * and what features that account supports.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6531 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6532 if ((gc != NULL) &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6533 ((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
6534 !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
6535 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6536 /* Account is online */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6537 /* Deal with the toolbar */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6538 if (conv->features & PURPLE_CONNECTION_HTML)
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 buttons = GTK_IMHTML_ALL; /* Everything on */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6541 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
6542 buttons &= ~GTK_IMHTML_BACKCOLOR;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6543 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
6544 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6545 buttons &= ~GTK_IMHTML_GROW;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6546 buttons &= ~GTK_IMHTML_SHRINK;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6547 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6548 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
6549 buttons &= ~GTK_IMHTML_LINKDESC;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6550 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6551 buttons = GTK_IMHTML_SMILEY | GTK_IMHTML_IMAGE;
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
18167
b8b475f31008 Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <stu@nosnilmot.com>
parents: 18121
diff changeset
6554 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
6555 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
6556
b8b475f31008 Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <stu@nosnilmot.com>
parents: 18121
diff changeset
6557 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
6558 buttons &= ~GTK_IMHTML_IMAGE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6559
23133
9aa105267f46 Show the custom smileys only on accounts that support it. References
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23131
diff changeset
6560 if (conv->features & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY)
9aa105267f46 Show the custom smileys only on accounts that support it. References
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23131
diff changeset
6561 buttons |= GTK_IMHTML_CUSTOM_SMILEY;
9aa105267f46 Show the custom smileys only on accounts that support it. References
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23131
diff changeset
6562 else
9aa105267f46 Show the custom smileys only on accounts that support it. References
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23131
diff changeset
6563 buttons &= ~GTK_IMHTML_CUSTOM_SMILEY;
31534
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 31517
diff changeset
6564
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6565 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
6566 if (account != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6567 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
6568
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6569 /* Deal with menu items */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6570 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
6571 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
6572 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
6573 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
6574 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
6575 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
6576
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6577 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
6578 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6579 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
6580 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
6581 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
6582 (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
6583 prpl_info->can_receive_file(gc, purple_conversation_get_name(conv)))));
29701
28880022598c Temporary workaround to not break ABI, to allow this in for 2.7.0
Marcus Lundblad <ml@update.uu.se>
parents: 29697
diff changeset
6584 gtk_widget_set_sensitive(g_object_get_data(G_OBJECT(win->window), "get_attention"), (prpl_info->send_attention != NULL));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6585 gtk_widget_set_sensitive(win->menu.alias,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6586 (account != NULL) &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6587 (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
6588 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6589 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
6590 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6591 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
6592 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
6593 gtk_widget_set_sensitive(win->menu.alias,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6594 (account != NULL) &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6595 (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
6596 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6597
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6598 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6599 /* Account is offline */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6600 /* 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
6601
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6602 /* Then deal with menu items */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6603 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
6604 gtk_widget_set_sensitive(win->menu.send_file, FALSE);
29701
28880022598c Temporary workaround to not break ABI, to allow this in for 2.7.0
Marcus Lundblad <ml@update.uu.se>
parents: 29697
diff changeset
6605 gtk_widget_set_sensitive(g_object_get_data(G_OBJECT(win->window),
28880022598c Temporary workaround to not break ABI, to allow this in for 2.7.0
Marcus Lundblad <ml@update.uu.se>
parents: 29697
diff changeset
6606 "get_attention"), FALSE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6607 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
6608 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
6609 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
6610 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
6611 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
6612 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
6613 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
6614 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
6615 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6616
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6617 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6618 * Update the window's icon
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6619 */
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6620 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
6621 {
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
6622 GList *l = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6623 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
6624 (gtkconv->u.im->anim))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6625 {
20183
dd4c3d712835 applied changes from 9d5a2f820265e4631d68d0f12a2def66acf36e3d
Richard Laager <rlaager@wiktel.com>
parents: 20028
diff changeset
6626 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
6627 window_icon =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6628 gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim);
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25362
diff changeset
6629
20183
dd4c3d712835 applied changes from 9d5a2f820265e4631d68d0f12a2def66acf36e3d
Richard Laager <rlaager@wiktel.com>
parents: 20028
diff changeset
6630 if (buddy && !PURPLE_BUDDY_IS_ONLINE(buddy))
dd4c3d712835 applied changes from 9d5a2f820265e4631d68d0f12a2def66acf36e3d
Richard Laager <rlaager@wiktel.com>
parents: 20028
diff changeset
6631 gdk_pixbuf_saturate_and_pixelate(window_icon, window_icon, 0.0, FALSE);
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25362
diff changeset
6632
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6633 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
6634 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
6635 } 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
6636 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
6637 }
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
6638 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
6639 if (window_icon != NULL) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6640 g_object_unref(G_OBJECT(window_icon));
15749
74923b83e042 Fix a small leak
Sean Egan <seanegan@gmail.com>
parents: 15748
diff changeset
6641 g_list_free(l);
74923b83e042 Fix a small leak
Sean Egan <seanegan@gmail.com>
parents: 15748
diff changeset
6642 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6643 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6644 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6645
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6646 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6647 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
6648 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6649 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6650 PidginWindow *win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6651
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6652 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6653 if (!gtkconv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6654 return;
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6655 win = pidgin_conv_get_window(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6656 if (!win)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6657 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6658
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6659 if (fields & PIDGIN_CONV_SET_TITLE)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6660 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6661 purple_conversation_autoset_title(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6662 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6663
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6664 if (fields & PIDGIN_CONV_BUDDY_ICON)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6665 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6666 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
6667 pidgin_conv_update_buddy_icon(conv);
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6668 }
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6669
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6670 if (fields & PIDGIN_CONV_MENU)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6671 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6672 gray_stuff_out(PIDGIN_CONVERSATION(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6673 generate_send_to_items(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6674 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6675
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6676 if (fields & PIDGIN_CONV_TAB_ICON)
15374
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 update_tab_icon(conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6679 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
6680 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6681
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6682 if ((fields & PIDGIN_CONV_TOPIC) &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6683 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
6684 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6685 const char *topic;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6686 PurpleConvChat *chat = PURPLE_CONV_CHAT(conv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6687 PidginChatPane *gtkchat = gtkconv->u.chat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6688
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6689 if (gtkchat->topic_text != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6690 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6691 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
6692
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6693 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
6694 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
6695 topic ? topic : "", NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6696 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6697 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6698
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6699 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
6700 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
6701
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6702 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
6703 (fields & PIDGIN_CONV_SET_TITLE) ||
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6704 (fields & PIDGIN_CONV_TOPIC))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6705 {
19291
c003aa584909 Remove truncation until we can do it smarter
Sean Egan <seanegan@gmail.com>
parents: 19290
diff changeset
6706 char *title;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6707 PurpleConvIm *im = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6708 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
6709 PurpleBuddy *buddy = NULL;
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6710 char *markup = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6711 AtkObject *accessibility_obj;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6712 /* 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
6713 char *style;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6714
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6715 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
6716 im = PURPLE_CONV_IM(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6717
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6718 if ((account == NULL) ||
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6719 !purple_account_is_connected(account) ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6720 ((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
6721 && 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
6722 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
6723 else
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6724 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
6725
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6726 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
6727 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
6728 if (buddy) {
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6729 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
6730 } else {
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6731 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
6732 }
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6733 } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) {
22633
0c59913dc8a0 Modified version of a patch from "dseven" to prevent crashing on NULL topics
Will Thompson <will.thompson@collabora.co.uk>
parents: 22626
diff changeset
6734 const char *topic = gtkconv->u.chat->topic_text
0c59913dc8a0 Modified version of a patch from "dseven" to prevent crashing on NULL topics
Will Thompson <will.thompson@collabora.co.uk>
parents: 22626
diff changeset
6735 ? gtk_entry_get_text(GTK_ENTRY(gtkconv->u.chat->topic_text))
0c59913dc8a0 Modified version of a patch from "dseven" to prevent crashing on NULL topics
Will Thompson <will.thompson@collabora.co.uk>
parents: 22626
diff changeset
6736 : NULL;
22435
5c72a6c071db Escape conversation title for use in infopane so that ampersands don't
Stu Tomlinson <stu@nosnilmot.com>
parents: 22422
diff changeset
6737 char *esc = NULL, *tmp;
21710
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6738 esc = topic ? g_markup_escape_text(topic, -1) : NULL;
22435
5c72a6c071db Escape conversation title for use in infopane so that ampersands don't
Stu Tomlinson <stu@nosnilmot.com>
parents: 22422
diff changeset
6739 tmp = g_markup_escape_text(purple_conversation_get_title(conv), -1);
18290
2e7a9f33cfd3 Handle NULL chat topics
Sean Egan <seanegan@gmail.com>
parents: 18289
diff changeset
6740 markup = g_strdup_printf("%s%s<span color='%s' size='smaller'>%s</span>",
22435
5c72a6c071db Escape conversation title for use in infopane so that ampersands don't
Stu Tomlinson <stu@nosnilmot.com>
parents: 22422
diff changeset
6741 tmp, esc && *esc ? "\n" : "",
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6742 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
6743 esc ? esc : "");
22435
5c72a6c071db Escape conversation title for use in infopane so that ampersands don't
Stu Tomlinson <stu@nosnilmot.com>
parents: 22422
diff changeset
6744 g_free(tmp);
19223
c8f18378045c Properly escape the chat-topics in the infopane. Fixes #1903.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18876
diff changeset
6745 g_free(esc);
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6746 }
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
6747 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
6748 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
6749 /* 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
6750 gtk_widget_queue_draw(gtkconv->infopane);
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6751
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
6752 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
6753 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
6754
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6755 if (!GTK_WIDGET_REALIZED(gtkconv->tab_label))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6756 gtk_widget_realize(gtkconv->tab_label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6757
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6758 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
6759 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
6760 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
6761 atk_object_set_description(accessibility_obj, _("Typing"));
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6762 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
6763 } 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
6764 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
6765 atk_object_set_description(accessibility_obj, _("Stopped Typing"));
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6766 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
6767 } 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
6768 atk_object_set_description(accessibility_obj, _("Nick Said"));
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6769 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
6770 } 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
6771 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
6772 if (gtkconv->active_conv->type == PURPLE_CONV_TYPE_CHAT)
21704
a4b36b22ea94 New style.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21703
diff changeset
6773 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
6774 else
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6775 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
6776 } 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
6777 atk_object_set_description(accessibility_obj, _("New Event"));
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6778 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
6779 } 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
6780 style = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6781 }
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
6782
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6783 gtk_widget_set_name(gtkconv->tab_label, style);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6784 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
6785 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
6786
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
6787 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
6788 gtkconv->unseen_state == PIDGIN_UNSEEN_NICK ||
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6789 gtkconv->unseen_state == PIDGIN_UNSEEN_EVENT) {
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6790 PangoAttrList *list = pango_attr_list_new();
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6791 PangoAttribute *attr = pango_attr_weight_new(PANGO_WEIGHT_BOLD);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6792 attr->start_index = 0;
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6793 attr->end_index = -1;
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6794 pango_attr_list_insert(list, attr);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6795 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
6796 pango_attr_list_unref(list);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6797 } else
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6798 gtk_label_set_attributes(GTK_LABEL(gtkconv->tab_label), NULL);
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25362
diff changeset
6799
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6800 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
6801 update_typing_icon(gtkconv);
22038
13d290879e0a shorted the 'typing then stopped' message
Sean Egan <seanegan@gmail.com>
parents: 22037
diff changeset
6802
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6803 gtk_label_set_text(GTK_LABEL(gtkconv->menu_label), title);
23783
a5bfc59b0c6e It turns out that setting the window title causes it to stop flashing on win32.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23359
diff changeset
6804 if (pidgin_conv_window_is_active_conversation(conv)) {
a5bfc59b0c6e It turns out that setting the window title causes it to stop flashing on win32.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23359
diff changeset
6805 const char* current_title = gtk_window_get_title(GTK_WINDOW(win->window));
a5bfc59b0c6e It turns out that setting the window title causes it to stop flashing on win32.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23359
diff changeset
6806 if (current_title == NULL || strcmp(current_title, title) != 0)
a5bfc59b0c6e It turns out that setting the window title causes it to stop flashing on win32.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23359
diff changeset
6807 gtk_window_set_title(GTK_WINDOW(win->window), title);
a5bfc59b0c6e It turns out that setting the window title causes it to stop flashing on win32.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23359
diff changeset
6808 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6809
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6810 g_free(title);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6811 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6812 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6813
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6814 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6815 pidgin_conv_updated(PurpleConversation *conv, PurpleConvUpdateType type)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6816 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6817 PidginConvFields flags = 0;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6818
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6819 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6820
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6821 if (type == PURPLE_CONV_UPDATE_ACCOUNT)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6822 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6823 flags = PIDGIN_CONV_ALL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6824 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6825 else if (type == PURPLE_CONV_UPDATE_TYPING ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6826 type == PURPLE_CONV_UPDATE_UNSEEN ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6827 type == PURPLE_CONV_UPDATE_TITLE)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6828 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6829 flags = PIDGIN_CONV_COLORIZE_TITLE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6830 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6831 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
6832 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6833 flags = PIDGIN_CONV_TOPIC;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6834 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6835 else if (type == PURPLE_CONV_ACCOUNT_ONLINE ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6836 type == PURPLE_CONV_ACCOUNT_OFFLINE)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6837 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6838 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
6839 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6840 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
6841 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6842 flags = PIDGIN_CONV_TAB_ICON;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6843 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6844 else if (type == PURPLE_CONV_UPDATE_ADD ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6845 type == PURPLE_CONV_UPDATE_REMOVE ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6846 type == PURPLE_CONV_UPDATE_CHATLEFT)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6847 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6848 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
6849 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6850 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
6851 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6852 flags = PIDGIN_CONV_BUDDY_ICON;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6853 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6854 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
6855 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6856 flags = PIDGIN_CONV_MENU;
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6857 }
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6858
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6859 pidgin_conv_update_fields(conv, flags);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6860 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6861
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
6862 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
6863 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
6864 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
6865 {
26623
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
6866 PidginConversation *gtkconv = conv ? PIDGIN_CONVERSATION(conv) : NULL;
15ae2dea92b3 Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26613
diff changeset
6867 if (conv == NULL || (gtkconv && gtkconv->win != hidden_convwin))
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
6868 return;
20953
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
6869 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
6870 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
6871
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
6872 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
6873 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
6874 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
6875 ((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
6876 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
6877 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
6878 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
6879 else
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
6880 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
6881
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
6882 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
6883 }
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
6884 }
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
6885
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6886 static PurpleConversationUiOps conversation_ui_ops =
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6887 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6888 pidgin_conv_new,
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6889 pidgin_conv_destroy, /* destroy_conversation */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6890 NULL, /* write_chat */
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6891 pidgin_conv_write_im, /* write_im */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6892 pidgin_conv_write_conv, /* write_conv */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6893 pidgin_conv_chat_add_users, /* chat_add_users */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6894 pidgin_conv_chat_rename_user, /* chat_rename_user */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6895 pidgin_conv_chat_remove_users, /* chat_remove_users */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6896 pidgin_conv_chat_update_user, /* chat_update_user */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6897 pidgin_conv_present_conversation, /* present */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6898 pidgin_conv_has_focus, /* has_focus */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6899 pidgin_conv_custom_smiley_add, /* custom_smiley_add */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6900 pidgin_conv_custom_smiley_write, /* custom_smiley_write */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6901 pidgin_conv_custom_smiley_close, /* custom_smiley_close */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6902 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
6903 NULL,
fbf111436896 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16604
diff changeset
6904 NULL,
fbf111436896 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16604
diff changeset
6905 NULL,
fbf111436896 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16604
diff changeset
6906 NULL
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6907 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6908
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6909 PurpleConversationUiOps *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6910 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
6911 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6912 return &conversation_ui_ops;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6913 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6914
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6915 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6916 * Public conversation utility functions
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6917 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6918 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6919 pidgin_conv_update_buddy_icon(PurpleConversation *conv)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6920 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6921 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6922 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6923
16381
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6924 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
6925
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6926 GdkPixbufLoader *loader;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6927 GdkPixbufAnimation *anim;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6928 GError *err = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6929
16381
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6930 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
6931 gconstpointer data = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6932 size_t len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6933
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6934 GdkPixbuf *buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6935
26986
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
6936 GList *children;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6937 GtkWidget *event;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6938 GdkPixbuf *scale;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6939 int scale_width, scale_height;
22733
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
6940 int size = 0;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6941
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6942 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6943
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6944 PurpleBuddyIcon *icon;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6945
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6946 g_return_if_fail(conv != NULL);
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
6947 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
6948 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
6949
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6950 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6951 win = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6952 if (conv != gtkconv->active_conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6953 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6954
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6955 if (!gtkconv->u.im->show_icon)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6956 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6957
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6958 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6959
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6960 /* Remove the current icon stuff */
26986
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
6961 children = gtk_container_get_children(GTK_CONTAINER(gtkconv->u.im->icon_container));
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
6962 if (children) {
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
6963 /* We know there's only one child here. It'd be nice to shortcut to the
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
6964 event box, but we can't change the PidginConversation until 3.0 */
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
6965 event = (GtkWidget *)children->data;
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
6966 gtk_container_remove(GTK_CONTAINER(gtkconv->u.im->icon_container), event);
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
6967 g_list_free(children);
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
6968 }
15374
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 if (gtkconv->u.im->anim != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6971 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
6972
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6973 gtkconv->u.im->anim = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6974
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6975 if (gtkconv->u.im->icon_timer != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6976 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
6977
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6978 gtkconv->u.im->icon_timer = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6979
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6980 if (gtkconv->u.im->iter != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6981 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
6982
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6983 gtkconv->u.im->iter = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6984
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
6985 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
6986 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6987
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6988 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
6989 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6990
16381
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6991 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
6992 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
6993 {
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6994 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
6995 if (contact) {
23123
0ca259d5f928 Compile and de-warn.
Etan Reisner <pidgin@unreliablesource.net>
parents: 23122
diff changeset
6996 custom_img = purple_buddy_icons_node_find_custom_icon((PurpleBlistNode*)contact);
16381
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6997 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
6998 /* 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
6999 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
7000 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
7001 }
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
7002 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7003 }
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 if (data == NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7006 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
7007
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7008 if (icon == NULL)
27561
3da1d149de25 If neither a locally-set custom icon nor a remotely-set buddy icon can be
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27552
diff changeset
7009 {
3da1d149de25 If neither a locally-set custom icon nor a remotely-set buddy icon can be
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27552
diff changeset
7010 gtk_widget_set_size_request(gtkconv->u.im->icon_container,
3da1d149de25 If neither a locally-set custom icon nor a remotely-set buddy icon can be
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27552
diff changeset
7011 -1, BUDDYICON_SIZE_MIN);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7012 return;
27561
3da1d149de25 If neither a locally-set custom icon nor a remotely-set buddy icon can be
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27552
diff changeset
7013 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7014
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7015 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
7016
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
7017 if (data == NULL)
27561
3da1d149de25 If neither a locally-set custom icon nor a remotely-set buddy icon can be
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27552
diff changeset
7018 {
3da1d149de25 If neither a locally-set custom icon nor a remotely-set buddy icon can be
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27552
diff changeset
7019 gtk_widget_set_size_request(gtkconv->u.im->icon_container,
3da1d149de25 If neither a locally-set custom icon nor a remotely-set buddy icon can be
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27552
diff changeset
7020 -1, BUDDYICON_SIZE_MIN);
16381
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
7021 return;
27561
3da1d149de25 If neither a locally-set custom icon nor a remotely-set buddy icon can be
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27552
diff changeset
7022 }
15374
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7025 loader = gdk_pixbuf_loader_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7026 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
7027 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
7028
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
7029 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
7030
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7031 anim = gdk_pixbuf_loader_get_animation(loader);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7032 if (anim)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7033 g_object_ref(G_OBJECT(anim));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7034 g_object_unref(loader);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7035
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7036 if (!anim)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7037 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7038 gtkconv->u.im->anim = anim;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7039
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7040 if (err) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7041 purple_debug(PURPLE_DEBUG_ERROR, "gtkconv",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7042 "Buddy icon error: %s\n", err->message);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7043 g_error_free(err);
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 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
7047 GdkPixbuf *stat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7048 gtkconv->u.im->iter = NULL;
18213
270e87f5cde0 Round the other icons too
Sean Egan <seanegan@gmail.com>
parents: 18212
diff changeset
7049 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
7050 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
7051 } else {
18213
270e87f5cde0 Round the other icons too
Sean Egan <seanegan@gmail.com>
parents: 18212
diff changeset
7052 GdkPixbuf *stat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7053 gtkconv->u.im->iter =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7054 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
7055 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
7056 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
7057 if (gtkconv->u.im->animate)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7058 start_anim(NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7059 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7060
18214
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
7061 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
7062 scale_height = gdk_pixbuf_get_height(buf);
22733
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
7063
26986
d62b94408a00 Set the buddy icon size request on gtkconv->u.im->icon_container instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26932
diff changeset
7064 gtk_widget_get_size_request(gtkconv->u.im->icon_container, NULL, &size);
22733
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
7065 size = MIN(size, MIN(scale_width, scale_height));
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
7066
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
7067 /* Some sanity checks */
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
7068 size = CLAMP(size, BUDDYICON_SIZE_MIN, BUDDYICON_SIZE_MAX);
18214
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
7069 if (scale_width == scale_height) {
22733
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
7070 scale_width = scale_height = size;
18214
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
7071 } else if (scale_height > scale_width) {
22733
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
7072 scale_width = size * scale_width / scale_height;
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
7073 scale_height = size;
18214
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
7074 } else {
22733
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
7075 scale_height = size * scale_height / scale_width;
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
7076 scale_width = size;
18214
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
7077 }
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
7078 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
7079 GDK_INTERP_BILINEAR);
18213
270e87f5cde0 Round the other icons too
Sean Egan <seanegan@gmail.com>
parents: 18212
diff changeset
7080 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
7081 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
7082 pidgin_gdk_pixbuf_make_round(scale);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7083
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7084 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
7085 gtk_container_add(GTK_CONTAINER(gtkconv->u.im->icon_container), event);
18821
0765cf9331f6 warning fixes
Sean Egan <seanegan@gmail.com>
parents: 18820
diff changeset
7086 gtk_event_box_set_visible_window(GTK_EVENT_BOX(event), FALSE);
18781
8b0663abb488 add tooltip to buddy icon in conversation too
Sean Egan <seanegan@gmail.com>
parents: 18779
diff changeset
7087 gtk_widget_add_events(event,
26434
e23a74d7c97c Get rid of the rest of the extraneous changes.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26361
diff changeset
7088 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
7089 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
7090 G_CALLBACK(icon_menu), gtkconv);
21945
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
7091
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
7092 pidgin_tooltip_setup_for_widget(event, gtkconv, pidgin_conv_create_tooltip, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7093 gtk_widget_show(event);
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 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
7096 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
7097 gtk_widget_show(gtkconv->u.im->icon);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7098
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7099 g_object_unref(G_OBJECT(scale));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7100
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7101 /* 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
7102 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
7103 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7104 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim);
23849
2f588ade5236 Oops, missed a bit of that patch there.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23848
diff changeset
7105 if (buddy && !PURPLE_BUDDY_IS_ONLINE(buddy))
2f588ade5236 Oops, missed a bit of that patch there.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23848
diff changeset
7106 gdk_pixbuf_saturate_and_pixelate(buf, buf, 0.0, FALSE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7107 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
7108 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7109 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7110
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7111 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7112 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
7113 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7114 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7115
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
7116 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7117 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7118
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7119 win = PIDGIN_CONVERSATION(conv)->win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7120
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7121 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
7122 gray_stuff_out(PIDGIN_CONVERSATION(conv));
15374
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
22193
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
7125 static gboolean
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
7126 pidgin_conv_xy_to_right_infopane(PidginWindow *win, int x, int y)
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
7127 {
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
7128 gint pane_x, pane_y, x_rel;
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
7129 PidginConversation *gtkconv;
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
7130
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
7131 gdk_window_get_origin(win->notebook->window, &pane_x, &pane_y);
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
7132 x_rel = x - pane_x;
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
7133 gtkconv = pidgin_conv_window_get_active_gtkconv(win);
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
7134 return (x_rel > gtkconv->infopane->allocation.x + gtkconv->infopane->allocation.width / 2);
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
7135 }
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
7136
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7137 int
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7138 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
7139 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7140 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
7141 GtkNotebook *notebook;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7142 GtkWidget *page, *tab;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7143 gint i, page_num = -1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7144 gint count;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7145 gboolean horiz;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7146
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7147 if (to_right)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7148 *to_right = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7149
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7150 notebook = GTK_NOTEBOOK(win->notebook);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7151
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7152 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
7153 x_rel = x - nb_x;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7154 y_rel = y - nb_y;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7155
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7156 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
7157 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
7158
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7159 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
7160
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7161 for (i = 0; i < count; i++) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7162
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7163 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
7164 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
7165
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7166 /* Make sure the tab is not hidden beyond an arrow */
22193
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
7167 if (!GTK_WIDGET_DRAWABLE(tab) && gtk_notebook_get_show_tabs(notebook))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7168 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7169
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7170 if (horiz) {
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
7171 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
7172 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
7173 page_num = i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7174
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7175 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
7176 *to_right = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7177
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7178 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7179 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7180 } else {
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
7181 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
7182 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
7183 page_num = i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7184
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7185 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
7186 *to_right = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7187
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7188 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7189 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7190 }
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7193 if (page_num == -1) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7194 /* Add after the last tab */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7195 page_num = count - 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7196 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7197
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7198 return page_num;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7199 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7200
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7201 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7202 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
7203 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7204 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
7205 GList *l;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7206 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7207 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7208
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7209 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
7210 conv = (PurpleConversation *)l->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7211
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
7212 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7213 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7214
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7215 gtkconv = PIDGIN_CONVERSATION(conv);
15374
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 if (value)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7218 gtk_widget_show(gtkconv->close);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7219 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7220 gtk_widget_hide(gtkconv->close);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7221 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7222 }
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 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7225 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
7226 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7227 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7228 #ifdef USE_GTKSPELL
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
7229 GList *cl;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7230 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7231 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7232 GtkSpell *spell;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7233
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7234 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
7235
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7236 conv = (PurpleConversation *)cl->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7237
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
7238 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7239 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7240
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7241 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7242
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7243 if (value)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7244 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
7245 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7246 spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(gtkconv->entry));
28626
ddbb3a85d9d8 Patch from Toby Schaffer to avoid an assertion when detaching an non-existant GtkSpell pointer. Fixes #10275.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28610
diff changeset
7247 if (spell)
ddbb3a85d9d8 Patch from Toby Schaffer to avoid an assertion when detaching an non-existant GtkSpell pointer. Fixes #10275.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28610
diff changeset
7248 gtkspell_detach(spell);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7249 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7250 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7251 #endif
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
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7255 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
7256 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7257 {
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
7258 GList *gtkwins, *gtkconvs;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7259 GtkPositionType pos;
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
7260 PidginWindow *gtkwin;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7261
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7262 pos = GPOINTER_TO_INT(value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7263
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
7264 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
7265 gtkwin = gtkwins->data;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
7266 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
7267 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
7268 pidgin_conv_tab_pack(gtkwin, gtkconvs->data);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
7269 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7270 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7271 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7272
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7273 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7274 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
7275 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7276 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
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;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7279 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7280 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7281
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7282 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
7283 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7284 conv = (PurpleConversation *)l->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7285
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
7286 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7287 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7288
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7289 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7290 win = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7291
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7292 gtk_check_menu_item_set_active(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7293 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
7294 (gboolean)GPOINTER_TO_INT(value));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7295
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7296 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
7297 (gboolean)GPOINTER_TO_INT(value));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7298 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7299 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7300
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7301 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7302 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
7303 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7304 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
7305 GList *l;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7306 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7307 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7308 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7309
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7310 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
7311 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7312 conv = (PurpleConversation *)l->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7313
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
7314 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7315 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7316
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7317 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7318 win = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7319
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7320 gtk_check_menu_item_set_active(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7321 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
7322 (gboolean)GPOINTER_TO_INT(value));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7323
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7324 if ((gboolean)GPOINTER_TO_INT(value))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7325 gtk_widget_show(gtkconv->toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7326 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7327 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
7328
21665
baa25b613999 Clean up warnings
Sean Egan <seanegan@gmail.com>
parents: 21664
diff changeset
7329 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
7330 }
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7333 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7334 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
7335 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7336 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
7337 GList *l;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7338 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7339 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7340 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7341
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7342 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
7343 return;
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 /* 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
7346 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
7347 conv = (PurpleConversation *)l->data;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7348 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
7349 if (gtkconv)
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
7350 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
7351 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7352
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7353 /* 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
7354 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
7355 win = l->data;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7356 conv = pidgin_conv_window_get_active_conversation(win);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7357 pidgin_conv_update_buddy_icon(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7358 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7359 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7360
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7361 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7362 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
7363 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7364 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
7365 GList *l;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7366
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7367 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
7368 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
7369 if (!PIDGIN_CONVERSATION(conv))
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
7370 continue;
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25362
diff changeset
7371 if (GPOINTER_TO_INT(value))
18602
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7372 gtk_widget_show(PIDGIN_CONVERSATION(conv)->infopane_hbox);
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7373 else
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7374 gtk_widget_hide(PIDGIN_CONVERSATION(conv)->infopane_hbox);
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7375
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7376 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
7377 pidgin_conv_update_buddy_icon(conv);
18602
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7378 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7379 }
23994
a0381a68ceef Fix the tab headers to display consistently when changing the "Show detailed
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23849
diff changeset
7380
a0381a68ceef Fix the tab headers to display consistently when changing the "Show detailed
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23849
diff changeset
7381 /* Make the tabs show/hide correctly */
a0381a68ceef Fix the tab headers to display consistently when changing the "Show detailed
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23849
diff changeset
7382 for (l = pidgin_conv_windows_get_list(); l != NULL; l = l->next) {
a0381a68ceef Fix the tab headers to display consistently when changing the "Show detailed
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23849
diff changeset
7383 PidginWindow *win = l->data;
a0381a68ceef Fix the tab headers to display consistently when changing the "Show detailed
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23849
diff changeset
7384 if (pidgin_conv_window_get_gtkconv_count(win) == 1)
a0381a68ceef Fix the tab headers to display consistently when changing the "Show detailed
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23849
diff changeset
7385 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook),
a0381a68ceef Fix the tab headers to display consistently when changing the "Show detailed
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23849
diff changeset
7386 GPOINTER_TO_INT(value) == 0);
a0381a68ceef Fix the tab headers to display consistently when changing the "Show detailed
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23849
diff changeset
7387 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7388 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7389
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7390 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
7391 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
7392 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
7393 {
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
7394 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
7395 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
7396 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
7397 if (PIDGIN_CONVERSATION(conv))
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
7398 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
7399 }
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
7400 }
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
7401
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
7402 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7403 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
7404 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7405 {
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7406 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
7407 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7408
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7409 static void
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7410 account_status_changed_cb(PurpleAccount *account, PurpleStatus *oldstatus,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7411 PurpleStatus *newstatus)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7412 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7413 GList *l;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7414 PurpleConversation *conv = NULL;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7415 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7416
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7417 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
7418 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7419
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7420 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
7421 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7422
24537
a05e9cf91efb Do not mistakenly use the preference to hide new IMs for persistent
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24513
diff changeset
7423 for (l = hidden_convwin->gtkconvs; l; ) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7424 gtkconv = l->data;
24537
a05e9cf91efb Do not mistakenly use the preference to hide new IMs for persistent
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24513
diff changeset
7425 l = l->next;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7426
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7427 conv = gtkconv->active_conv;
24537
a05e9cf91efb Do not mistakenly use the preference to hide new IMs for persistent
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24513
diff changeset
7428 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT ||
a05e9cf91efb Do not mistakenly use the preference to hide new IMs for persistent
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24513
diff changeset
7429 account != purple_conversation_get_account(conv))
a05e9cf91efb Do not mistakenly use the preference to hide new IMs for persistent
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24513
diff changeset
7430 continue;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7431
23998
ac3db6ba7078 Fix the conversation window closing unexpectedly. Again.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23994
diff changeset
7432 pidgin_conv_attach_to_conversation(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7433
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7434 /* 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
7435 * 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
7436 purple_conversation_update(conv, PURPLE_CONV_UPDATE_UNSEEN);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7437 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7438 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7439
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7440 static void
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7441 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
7442 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7443 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7444 GList *l;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7445 PurpleConversation *conv = NULL;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7446 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7447 gboolean when_away = FALSE;
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 if(!hidden_convwin)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7450 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7451
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7452 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
7453 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7454
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7455 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
7456 when_away = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7457
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
7458 for (l = hidden_convwin->gtkconvs; l; )
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7459 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7460 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
7461 l = l->next;
15374
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 conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7464
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
7465 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
7466 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
7467 (when_away && !purple_status_is_available(
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7468 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
7469 purple_conversation_get_account(conv)))))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7470 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7471
23998
ac3db6ba7078 Fix the conversation window closing unexpectedly. Again.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23994
diff changeset
7472 pidgin_conv_attach_to_conversation(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7473 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7474 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7475
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7476
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7477 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7478 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
7479 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7480 {
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
7481 PidginConvPlacementFunc func;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7482
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7483 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
7484 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7485
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7486 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
7487
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7488 if (func == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7489 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7490
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7491 pidgin_conv_placement_set_current_func(func);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7492 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7493
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7494 static PidginConversation *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7495 get_gtkconv_with_contact(PurpleContact *contact)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7496 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7497 PurpleBlistNode *node;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7498
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7499 node = ((PurpleBlistNode*)contact)->child;
15374
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 for (; node; node = node->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7502 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7503 PurpleBuddy *buddy = (PurpleBuddy*)node;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7504 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7505 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
7506 if (conv)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7507 return PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7508 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7509 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7510 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7511
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7512 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7513 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
7514 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
7515 GList *iter;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7516
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7517 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
7518 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7519 PurpleConversation *conv = iter->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7520
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7521 /* 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
7522 * 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
7523 * 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
7524 * 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
7525 /* if (purple_conversation_get_account(conv) == account) */
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7526 pidgin_conv_update_fields(conv, PIDGIN_CONV_TAB_ICON |
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7527 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
7528
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7529 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
7530 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
7531 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
7532 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
7533 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
7534 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
7535 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
7536 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
7537 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
7538 } else {
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7539 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
7540 }
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7541 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
7542 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
7543 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
7544 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7545 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7546 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7547
28781
71dc3b5edbe7 Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28687
diff changeset
7548 static void
71dc3b5edbe7 Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28687
diff changeset
7549 account_signing_off(PurpleConnection *gc)
71dc3b5edbe7 Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28687
diff changeset
7550 {
71dc3b5edbe7 Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28687
diff changeset
7551 GList *list = purple_get_chats();
28789
e7bb163434c7 Show the message only for the chats for the account signing off.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28781
diff changeset
7552 PurpleAccount *account = purple_connection_get_account(gc);
28781
71dc3b5edbe7 Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28687
diff changeset
7553
71dc3b5edbe7 Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28687
diff changeset
7554 /* We are about to sign off. See which chats we are currently in, and mark
71dc3b5edbe7 Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28687
diff changeset
7555 * them for rejoin on reconnect. */
71dc3b5edbe7 Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28687
diff changeset
7556 while (list) {
71dc3b5edbe7 Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28687
diff changeset
7557 PurpleConversation *conv = list->data;
28789
e7bb163434c7 Show the message only for the chats for the account signing off.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28781
diff changeset
7558 if (!purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv)) &&
e7bb163434c7 Show the message only for the chats for the account signing off.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28781
diff changeset
7559 purple_conversation_get_account(conv) == account) {
28781
71dc3b5edbe7 Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28687
diff changeset
7560 purple_conversation_set_data(conv, "want-to-rejoin", GINT_TO_POINTER(TRUE));
71dc3b5edbe7 Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28687
diff changeset
7561 purple_conversation_write(conv, NULL, _("The account has disconnected and you are no "
71dc3b5edbe7 Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28687
diff changeset
7562 "longer in this chat. You will be automatically rejoined in the chat when "
71dc3b5edbe7 Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28687
diff changeset
7563 "the account reconnects."),
71dc3b5edbe7 Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28687
diff changeset
7564 PURPLE_MESSAGE_SYSTEM, time(NULL));
71dc3b5edbe7 Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28687
diff changeset
7565 }
71dc3b5edbe7 Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28687
diff changeset
7566 list = list->next;
71dc3b5edbe7 Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28687
diff changeset
7567 }
71dc3b5edbe7 Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28687
diff changeset
7568 }
71dc3b5edbe7 Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28687
diff changeset
7569
29253
f75c1323c996 *** Plucked rev 3976bac9dc1aafa42217dda56118316cb2fed956 (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 29051
diff changeset
7570 struct _status_timeout_user {
f75c1323c996 *** Plucked rev 3976bac9dc1aafa42217dda56118316cb2fed956 (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 29051
diff changeset
7571 gchar *name;
f75c1323c996 *** Plucked rev 3976bac9dc1aafa42217dda56118316cb2fed956 (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 29051
diff changeset
7572 PurpleAccount *account;
f75c1323c996 *** Plucked rev 3976bac9dc1aafa42217dda56118316cb2fed956 (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 29051
diff changeset
7573 };
f75c1323c996 *** Plucked rev 3976bac9dc1aafa42217dda56118316cb2fed956 (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 29051
diff changeset
7574
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7575 static gboolean
29253
f75c1323c996 *** Plucked rev 3976bac9dc1aafa42217dda56118316cb2fed956 (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 29051
diff changeset
7576 update_buddy_status_timeout(struct _status_timeout_user *user)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7577 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7578 /* 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
7579 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7580
29253
f75c1323c996 *** Plucked rev 3976bac9dc1aafa42217dda56118316cb2fed956 (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 29051
diff changeset
7581 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, user->name, user->account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7582 if (conv)
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7583 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
7584
29253
f75c1323c996 *** Plucked rev 3976bac9dc1aafa42217dda56118316cb2fed956 (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 29051
diff changeset
7585 g_free(user->name);
f75c1323c996 *** Plucked rev 3976bac9dc1aafa42217dda56118316cb2fed956 (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 29051
diff changeset
7586 g_free(user);
f75c1323c996 *** Plucked rev 3976bac9dc1aafa42217dda56118316cb2fed956 (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 29051
diff changeset
7587
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7588 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7589 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7590
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7591 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7592 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
7593 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7594 PidginConversation *gtkconv;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7595 PurpleConversation *conv;
29253
f75c1323c996 *** Plucked rev 3976bac9dc1aafa42217dda56118316cb2fed956 (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 29051
diff changeset
7596 struct _status_timeout_user *user;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7597
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7598 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
7599 if (gtkconv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7600 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7601 conv = gtkconv->active_conv;
23848
ca3dc911bf52 A patch from nowic to re-colorize the greyed out icon when a buddy signs
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23841
diff changeset
7602 pidgin_conv_update_fields(conv, PIDGIN_CONV_TAB_ICON
ca3dc911bf52 A patch from nowic to re-colorize the greyed out icon when a buddy signs
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23841
diff changeset
7603 | PIDGIN_CONV_COLORIZE_TITLE
ca3dc911bf52 A patch from nowic to re-colorize the greyed out icon when a buddy signs
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23841
diff changeset
7604 | PIDGIN_CONV_BUDDY_ICON);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7605 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
7606 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
7607 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7608
29253
f75c1323c996 *** Plucked rev 3976bac9dc1aafa42217dda56118316cb2fed956 (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 29051
diff changeset
7609 user = g_malloc(sizeof(struct _status_timeout_user));
f75c1323c996 *** Plucked rev 3976bac9dc1aafa42217dda56118316cb2fed956 (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 29051
diff changeset
7610 user->name = g_strdup(buddy->name);
f75c1323c996 *** Plucked rev 3976bac9dc1aafa42217dda56118316cb2fed956 (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 29051
diff changeset
7611 user->account = buddy->account;
f75c1323c996 *** Plucked rev 3976bac9dc1aafa42217dda56118316cb2fed956 (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 29051
diff changeset
7612
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7613 /* In case a conversation is started after the buddy has signed-on/off */
29253
f75c1323c996 *** Plucked rev 3976bac9dc1aafa42217dda56118316cb2fed956 (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 29051
diff changeset
7614 purple_timeout_add_seconds(11, (GSourceFunc)update_buddy_status_timeout, user);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7615 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7616
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7617 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7618 update_buddy_privacy_changed(PurpleBuddy *buddy)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7619 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7620 PidginConversation *gtkconv;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7621 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7622
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7623 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
7624 if (gtkconv) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7625 conv = gtkconv->active_conv;
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7626 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
7627 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7628 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7629
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7630 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7631 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
7632 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7633 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7634
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7635 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
7636 if (conv)
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7637 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
7638 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7639
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7640 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7641 update_buddy_icon(PurpleBuddy *buddy)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7642 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7643 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7644
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7645 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
7646 if (conv)
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7647 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
7648 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7649
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7650 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7651 update_buddy_sign(PurpleBuddy *buddy, const char *which)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7652 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7653 PurplePresence *presence;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7654 PurpleStatus *on, *off;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7655
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7656 presence = purple_buddy_get_presence(buddy);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7657 if (!presence)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7658 return;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7659 off = purple_presence_get_status(presence, "offline");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7660 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
7661
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7662 if (*(which+1) == 'f')
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7663 update_buddy_status_changed(buddy, on, off);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7664 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7665 update_buddy_status_changed(buddy, off, on);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7666 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7667
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7668 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7669 update_conversation_switched(PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7670 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7671 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
7672 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
7673 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7674
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7675 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7676 update_buddy_typing(PurpleAccount *account, const char *who)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7677 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7678 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7679 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7680
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7681 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
7682 if (!conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7683 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7684
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7685 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7686 if (gtkconv && gtkconv->active_conv == conv)
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7687 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
7688 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7689
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7690 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7691 update_chat(PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7692 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7693 pidgin_conv_update_fields(conv, PIDGIN_CONV_TOPIC |
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7694 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
7695 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7696
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7697 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7698 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
7699 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7700 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
7701 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7702
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7703 /* Message history stuff */
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7704
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7705 /* 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
7706 static int
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7707 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
7708 {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7709 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
7710 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
7711 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7712
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7713 /* 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
7714 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
7715 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
7716 {
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7717 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
7718 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
7719 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
7720 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
7721 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
7722
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
7723 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
7724 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
7725 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
7726 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
7727 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
7728 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
7729 }
21263
1812b8ccfd7a Show alias in restored conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21244
diff changeset
7730 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
7731 if (im) {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7732 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
7733 } else {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7734 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
7735 }
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
7736 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
7737 }
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7738 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
7739 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
7740 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
7741
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7742 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
7743 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
7744 if (im) {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7745 /* 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
7746 GList *msgs = NULL;
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7747 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
7748 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
7749 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
7750 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
7751 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
7752 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
7753 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
7754 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
7755 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7756 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7757 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
7758 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
7759 PurpleConvMessage *msg = msgs->data;
21263
1812b8ccfd7a Show alias in restored conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21244
diff changeset
7760 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
7761 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7762 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
7763 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
7764 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7765
20552
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7766 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
7767 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
7768 "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
7769 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
7770 }
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7771
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7772 static void
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7773 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
7774 {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7775 int timer;
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7776 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
7777 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
7778 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
7779 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
7780 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
7781 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
7782 if (timer) {
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7783 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
7784 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
7785 }
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7786 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7787
19417
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7788 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
7789 {
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7790 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
7791 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
7792
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7793 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
7794 /* This is pretty much always the case now. */
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7795 gtkconv = PIDGIN_CONVERSATION(conv);
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7796 if (gtkconv->win != hidden_convwin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7797 return FALSE;
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7798 pidgin_conv_window_remove_gtkconv(hidden_convwin, gtkconv);
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7799 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
7800 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
7801 "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
7802 list = gtkconv->convs;
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
7803 while (list) {
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
7804 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
7805 list = list->next;
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
7806 }
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7807 return TRUE;
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7808 }
19417
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7809
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7810 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
7811 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
7812
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7813 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
7814 if (list) {
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7815 switch (purple_conversation_get_type(conv)) {
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25362
diff changeset
7816 case PURPLE_CONV_TYPE_IM:
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7817 {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7818 GList *convs;
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7819 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
7820 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
7821 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
7822 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
7823 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
7824 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
7825 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7826 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
7827 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
7828 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
7829 break;
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7830 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7831 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
7832 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
7833 break;
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7834 default:
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7835 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
7836 }
20051
d9a6d6ac2537 We can do this without forcing a minor bump.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20050
diff changeset
7837 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
7838 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
7839 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
7840 } else {
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7841 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
7842 "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
7843 }
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7844
19559
11849a5c3951 Update the chat topic and userlist when reattaching the Pidgin UI.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19556
diff changeset
7845 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
7846 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
7847 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
7848 }
19417
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7849
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7850 return TRUE;
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7851 }
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7852
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7853 void *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7854 pidgin_conversations_get_handle(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7855 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7856 static int handle;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7857
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7858 return &handle;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7859 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7860
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7861 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7862 pidgin_conversations_init(void)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7863 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7864 void *handle = pidgin_conversations_get_handle();
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7865 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
7866
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7867 /* 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
7868 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
7869 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
7870 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/close_on_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
7871 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
7872 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
7873 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
7874 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
7875 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/show_incoming_formatting", TRUE);
22802
958f9379eb1a Add a "minimum lines" pref for the im entry box thing; up to 8 lines.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22791
diff changeset
7876 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/minimum_entry_lines", 2);
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7877
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7878 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
7879 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
7880
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7881 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
7882 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
7883 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
7884 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
7885 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
7886 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
7887 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
7888 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
7889 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
7890
28960
b027d1d97edb I *think* this properly adds back the font preference stuff I axed earlier, but
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28937
diff changeset
7891 #ifdef _WIN32
b027d1d97edb I *think* this properly adds back the font preference stuff I axed earlier, but
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28937
diff changeset
7892 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/use_theme_font", TRUE);
b027d1d97edb I *think* this properly adds back the font preference stuff I axed earlier, but
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28937
diff changeset
7893 purple_prefs_add_string(PIDGIN_PREFS_ROOT "/conversations/custom_font", "");
b027d1d97edb I *think* this properly adds back the font preference stuff I axed earlier, but
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28937
diff changeset
7894 #endif
b027d1d97edb I *think* this properly adds back the font preference stuff I axed earlier, but
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28937
diff changeset
7895
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7896 /* 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
7897 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
7898 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
7899 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
7900 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
7901 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
7902 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
7903 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
7904
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7905 /* 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
7906 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
7907 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
7908 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
7909 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
7910 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
7911
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7912 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
7913
19229
f1fb41d31c70 Set a larger default conversation size. Previously we were using
Mark Doliner <mark@kingant.net>
parents: 19223
diff changeset
7914 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
7915 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
7916
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7917 purple_prefs_add_string(PIDGIN_PREFS_ROOT "/conversations/im/hide_new", "never");
22287
36036b9489fe Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <stu@nosnilmot.com>
parents: 22281
diff changeset
7918 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/im/close_immediately", TRUE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7919
18779
f6656fd1d2d5 Initialize the win32 minimize new conv. windows pref to avoid warnings.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18760
diff changeset
7920 #ifdef _WIN32
f6656fd1d2d5 Initialize the win32 minimize new conv. windows pref to avoid warnings.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18760
diff changeset
7921 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
7922 #endif
f6656fd1d2d5 Initialize the win32 minimize new conv. windows pref to avoid warnings.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18760
diff changeset
7923
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7924 /* 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
7925 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
7926 close_on_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
7927 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
7928 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
7929 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
7930 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
7931 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
7932 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
7933 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
7934 tab_side_pref_cb, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7935
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7936 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
7937 conv_placement_usetabs_cb, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7938
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7939 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
7940 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
7941 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
7942
22802
958f9379eb1a Add a "minimum lines" pref for the im entry box thing; up to 8 lines.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22791
diff changeset
7943 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/minimum_entry_lines",
958f9379eb1a Add a "minimum lines" pref for the im entry box thing; up to 8 lines.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22791
diff changeset
7944 minimum_entry_lines_pref_cb, NULL);
958f9379eb1a Add a "minimum lines" pref for the im entry box thing; up to 8 lines.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22791
diff changeset
7945
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7946 /* 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
7947 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
7948 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
7949 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
7950 show_buddy_icons_pref_cb, NULL);
22725
fe546f9e3cbf Use the correct name for a preference. This will correctly update the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22678
diff changeset
7951 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/blist/show_protocol_icons",
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
7952 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
7953 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
7954 hide_new_pref_cb, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7955
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7956
26434
e23a74d7c97c Get rid of the rest of the extraneous changes.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26361
diff changeset
7957
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7958 /**********************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7959 * Register signals
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7960 **********************************************************************/
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7961 purple_signal_register(handle, "conversation-dragging",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7962 purple_marshal_VOID__POINTER_POINTER, NULL, 2,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7963 purple_value_new(PURPLE_TYPE_BOXED,
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7964 "PidginWindow *"),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7965 purple_value_new(PURPLE_TYPE_BOXED,
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7966 "PidginWindow *"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7967
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7968 purple_signal_register(handle, "conversation-timestamp",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7969 #if SIZEOF_TIME_T == 4
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7970 purple_marshal_POINTER__POINTER_INT_BOOLEAN,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7971 #elif SIZEOF_TIME_T == 8
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7972 purple_marshal_POINTER__POINTER_INT64_BOOLEAN,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7973 #else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7974 #error Unkown size of time_t
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7975 #endif
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7976 purple_value_new(PURPLE_TYPE_STRING), 3,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7977 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7978 PURPLE_SUBTYPE_CONVERSATION),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7979 #if SIZEOF_TIME_T == 4
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7980 purple_value_new(PURPLE_TYPE_INT),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7981 #elif SIZEOF_TIME_T == 8
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7982 purple_value_new(PURPLE_TYPE_INT64),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7983 #else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7984 # error Unknown size of time_t
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7985 #endif
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7986 purple_value_new(PURPLE_TYPE_BOOLEAN));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7987
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7988 purple_signal_register(handle, "displaying-im-msg",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7989 purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7990 purple_value_new(PURPLE_TYPE_BOOLEAN), 5,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7991 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7992 PURPLE_SUBTYPE_ACCOUNT),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7993 purple_value_new(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7994 purple_value_new_outgoing(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7995 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7996 PURPLE_SUBTYPE_CONVERSATION),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7997 purple_value_new(PURPLE_TYPE_INT));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7998
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7999 purple_signal_register(handle, "displayed-im-msg",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8000 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
8001 NULL, 5,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8002 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8003 PURPLE_SUBTYPE_ACCOUNT),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8004 purple_value_new(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8005 purple_value_new(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8006 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8007 PURPLE_SUBTYPE_CONVERSATION),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8008 purple_value_new(PURPLE_TYPE_INT));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8009
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8010 purple_signal_register(handle, "displaying-chat-msg",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8011 purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8012 purple_value_new(PURPLE_TYPE_BOOLEAN), 5,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8013 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8014 PURPLE_SUBTYPE_ACCOUNT),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8015 purple_value_new(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8016 purple_value_new_outgoing(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8017 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8018 PURPLE_SUBTYPE_CONVERSATION),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8019 purple_value_new(PURPLE_TYPE_INT));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8020
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8021 purple_signal_register(handle, "displayed-chat-msg",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8022 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
8023 NULL, 5,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8024 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8025 PURPLE_SUBTYPE_ACCOUNT),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8026 purple_value_new(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8027 purple_value_new(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8028 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8029 PURPLE_SUBTYPE_CONVERSATION),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8030 purple_value_new(PURPLE_TYPE_INT));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8031
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8032 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
8033 purple_marshal_VOID__POINTER, NULL, 1,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8034 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8035 PURPLE_SUBTYPE_CONVERSATION));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8036
19556
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
8037 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
8038 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
8039 purple_value_new(PURPLE_TYPE_BOXED,
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
8040 "PidginConversation *"));
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
8041
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
8042 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
8043 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
8044 purple_value_new(PURPLE_TYPE_BOXED,
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
8045 "PidginConversation *"));
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
8046
15374
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 * Register commands
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8049 **********************************************************************/
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8050 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
8051 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
8052 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
8053 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
8054 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
8055 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
8056 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
8057 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
8058 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
8059 purple_cmd_register("clear", "", PURPLE_CMD_P_DEFAULT,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8060 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
8061 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
8062 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
8063 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
8064 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
8065 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
8066 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
8067 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
8068
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8069 /**********************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8070 * UI operations
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8071 **********************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8072
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8073 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
8074 G_CALLBACK(account_signed_off_cb),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8075 GINT_TO_POINTER(PURPLE_CONV_ACCOUNT_ONLINE));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8076 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
8077 G_CALLBACK(account_signed_off_cb),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8078 GINT_TO_POINTER(PURPLE_CONV_ACCOUNT_OFFLINE));
28781
71dc3b5edbe7 Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28687
diff changeset
8079 purple_signal_connect(purple_connections_get_handle(), "signing-off", handle,
71dc3b5edbe7 Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28687
diff changeset
8080 G_CALLBACK(account_signing_off), NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8081
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8082 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
8083 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
8084
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8085 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
8086
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8087 hidden_convwin = pidgin_conv_window_new();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8088 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
8089
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8090 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
8091 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
8092
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8093 /* Callbacks to update a conversation */
26878
0924698e2362 Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents: 26727
diff changeset
8094 purple_signal_connect(blist_handle, "blist-node-added", handle,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8095 G_CALLBACK(buddy_update_cb), NULL);
26878
0924698e2362 Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents: 26727
diff changeset
8096 purple_signal_connect(blist_handle, "blist-node-removed", handle,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8097 G_CALLBACK(buddy_update_cb), NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8098 purple_signal_connect(blist_handle, "buddy-signed-on",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8099 handle, PURPLE_CALLBACK(update_buddy_sign), "on");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8100 purple_signal_connect(blist_handle, "buddy-signed-off",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8101 handle, PURPLE_CALLBACK(update_buddy_sign), "off");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8102 purple_signal_connect(blist_handle, "buddy-status-changed",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8103 handle, PURPLE_CALLBACK(update_buddy_status_changed), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8104 purple_signal_connect(blist_handle, "buddy-privacy-changed",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8105 handle, PURPLE_CALLBACK(update_buddy_privacy_changed), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8106 purple_signal_connect(blist_handle, "buddy-idle-changed",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8107 handle, PURPLE_CALLBACK(update_buddy_idle_changed), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8108 purple_signal_connect(blist_handle, "buddy-icon-changed",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8109 handle, PURPLE_CALLBACK(update_buddy_icon), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8110 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
8111 handle, PURPLE_CALLBACK(update_buddy_typing), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8112 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
8113 handle, PURPLE_CALLBACK(update_buddy_typing), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8114 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
8115 handle, PURPLE_CALLBACK(update_conversation_switched), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8116 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
8117 PURPLE_CALLBACK(update_chat), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8118 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
8119 PURPLE_CALLBACK(update_chat), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8120 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
8121 PURPLE_CALLBACK(update_chat_topic), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8122 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
8123 PURPLE_CALLBACK(pidgin_conv_updated), NULL,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8124 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
8125 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
8126 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
8127 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
8128 PURPLE_CALLBACK(wrote_msg_update_unseen_cb), NULL);
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
8129
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
8130 {
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
8131 /* Set default tab colors */
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
8132 GString *str = g_string_new(NULL);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
8133 GtkSettings *settings = gtk_settings_get_default();
21896
31a48cbc5e12 This fixes the tab-coloring issue that's been bugging seanegn.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21894
diff changeset
8134 GtkStyle *parent = gtk_rc_get_style_by_paths(settings, "tab-container.tab-label*", NULL, G_TYPE_NONE), *now;
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
8135 struct {
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
8136 const char *stylename;
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
8137 const char *labelname;
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
8138 const char *color;
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
8139 } styles[] = {
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
8140 {"pidgin_tab_label_typing_default", "tab-label-typing", "#4e9a06"},
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
8141 {"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
8142 {"pidgin_tab_label_attention_default", "tab-label-attention", "#006aff"},
21704
a4b36b22ea94 New style.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21703
diff changeset
8143 {"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
8144 {"pidgin_tab_label_event_default", "tab-label-event", "#888a85"},
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
8145 {NULL, NULL, NULL}
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
8146 };
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
8147 int iter;
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
8148 for (iter = 0; styles[iter].stylename; iter++) {
21896
31a48cbc5e12 This fixes the tab-coloring issue that's been bugging seanegn.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21894
diff changeset
8149 now = gtk_rc_get_style_by_paths(settings, styles[iter].labelname, NULL, G_TYPE_NONE);
31a48cbc5e12 This fixes the tab-coloring issue that's been bugging seanegn.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21894
diff changeset
8150 if (parent == now ||
31a48cbc5e12 This fixes the tab-coloring issue that's been bugging seanegn.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21894
diff changeset
8151 (parent && now && parent->rc_style == now->rc_style)) {
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
8152 g_string_append_printf(str, "style \"%s\" {\n"
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
8153 "fg[ACTIVE] = \"%s\"\n"
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
8154 "}\n"
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
8155 "widget \"*%s\" style \"%s\"\n",
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
8156 styles[iter].stylename,
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
8157 styles[iter].color,
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
8158 styles[iter].labelname, styles[iter].stylename);
21896
31a48cbc5e12 This fixes the tab-coloring issue that's been bugging seanegn.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21894
diff changeset
8159 }
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
8160 }
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
8161 gtk_rc_parse_string(str->str);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
8162 g_string_free(str, TRUE);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
8163 gtk_rc_reset_styles(settings);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
8164 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8165 }
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 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8168 pidgin_conversations_uninit(void)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8169 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8170 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
8171 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
8172 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
8173 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8174
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8175
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8176
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8177
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8178
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8179
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8180
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8181
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8182
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8183
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8184
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8185
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8186
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8187
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8188
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8189
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8190 /* 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
8191 * 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
8192
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8193 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8194 * @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
8195 * @ingroup pidgin
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8196 *
15871
66dff3dfdea6 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
8197 * pidgin
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8198 *
15871
66dff3dfdea6 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
8199 * 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
8200 * 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
8201 * source distribution.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8202 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8203 * 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
8204 * 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
8205 * 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
8206 * (at your option) any later version.
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 * 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
8209 * 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
8210 * 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
8211 * GNU General Public License for more details.
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 * 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
8214 * 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
8215 * 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
8216 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8217 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8218 #include "internal.h"
15514
535f002e7b0f More pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15509
diff changeset
8219 #include "pidgin.h"
15374
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8222 #include <gdk/gdkkeysyms.h>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8223
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8224 #include "account.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8225 #include "cmds.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8226 #include "debug.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8227 #include "imgstore.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8228 #include "log.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8229 #include "notify.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8230 #include "prpl.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8231 #include "request.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8232 #include "util.h"
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 #include "gtkdnd-hints.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8235 #include "gtkblist.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8236 #include "gtkconv.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8237 #include "gtkdialogs.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8238 #include "gtkmenutray.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8239 #include "gtkpounce.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8240 #include "gtkprefs.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8241 #include "gtkprivacy.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8242 #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
8243 #include "pidginstock.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8244 #include "gtkimhtml.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8245 #include "gtkimhtmltoolbar.h"
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 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
8249 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8250 gtk_widget_destroy(warn_close_dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8251 warn_close_dialog = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8252
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8253 if (resp == GTK_RESPONSE_OK)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8254 pidgin_conv_window_destroy(win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8255 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8256
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8257 static void
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8258 build_warn_close_dialog(PidginWindow *gtkwin)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8259 {
27423
9c0a18f16fce I was going to change the g_return_if_fail to a normal return but it actually
Etan Reisner <pidgin@unreliablesource.net>
parents: 27419
diff changeset
8260 GtkWidget *label, *vbox, *hbox, *img;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8261
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8262 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
8263
27423
9c0a18f16fce I was going to change the g_return_if_fail to a normal return but it actually
Etan Reisner <pidgin@unreliablesource.net>
parents: 27419
diff changeset
8264 warn_close_dialog = gtk_dialog_new_with_buttons(_("Confirm close"),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8265 GTK_WINDOW(gtkwin->window), GTK_DIALOG_MODAL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8266 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
8267 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
8268
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8269 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
8270 GTK_RESPONSE_OK);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8271
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8272 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
8273 6);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8274 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
8275 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
8276 FALSE);
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 /* Setup the outside spacing. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8279 vbox = GTK_DIALOG(warn_close_dialog)->vbox;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8280
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8281 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
8282 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
8283
15436
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15435
diff changeset
8284 img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_WARNING,
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15435
diff changeset
8285 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
8286 /* 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
8287 hbox = gtk_hbox_new(FALSE, 12);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8288 gtk_container_add(GTK_CONTAINER(vbox), hbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8289 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
8290 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
8291
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8292 /* Setup the right vbox. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8293 vbox = gtk_vbox_new(FALSE, 12);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8294 gtk_container_add(GTK_CONTAINER(hbox), vbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8295
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8296 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
8297 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
8298 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
8299 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
8300 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
8301
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8302 /* Connect the signals. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8303 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
8304 G_CALLBACK(do_close), gtkwin);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8305
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8306 }
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 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8309 * Callbacks
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8312 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8313 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
8314 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8315 PidginWindow *win = d;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8316 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8317
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8318 /* 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
8319 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
8320 l != NULL; l = l->next)
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 PidginConversation *gtkconv = l->data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8323 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
8324 gtkconv->unseen_state >= PIDGIN_UNSEEN_TEXT)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8325 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8326 build_warn_close_dialog(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8327 gtk_widget_show_all(warn_close_dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8328
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8329 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8330 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8331 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8332
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8333 pidgin_conv_window_destroy(win);
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 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8336 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8337
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8338 static void
20953
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8339 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
8340 {
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8341 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
8342 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
8343
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8344 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
8345 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
8346
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8347 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
8348 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
8349
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8350 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
8351 {
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8352 unseen_count = 0;
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8353 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
8354 }
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8355 else
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8356 {
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8357 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
8358 unseen_count++;
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8359
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8360 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
8361 unseen_state = state;
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8362 }
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8363
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8364 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
8365 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
8366
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8367 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
8368 }
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8369
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8370 static void
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
8371 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
8372 {
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
8373 if (state == PIDGIN_UNSEEN_NONE)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8374 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8375 gtkconv->unseen_count = 0;
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
8376 gtkconv->unseen_state = PIDGIN_UNSEEN_NONE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8377 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8378 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8379 {
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
8380 if (state >= PIDGIN_UNSEEN_TEXT)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8381 gtkconv->unseen_count++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8382
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8383 if (state > gtkconv->unseen_state)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8384 gtkconv->unseen_state = state;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8385 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8386
26932
04af21d4be27 Set PurpleConversation unseen-(count|state) in gtkconv_set_unseen, as conv_set_unseen only sets it for hidden_conv conversations. Fixes #8358
jcs@jcs.org
parents: 26878
diff changeset
8387 purple_conversation_set_data(gtkconv->active_conv, "unseen-count", GINT_TO_POINTER(gtkconv->unseen_count));
04af21d4be27 Set PurpleConversation unseen-(count|state) in gtkconv_set_unseen, as conv_set_unseen only sets it for hidden_conv conversations. Fixes #8358
jcs@jcs.org
parents: 26878
diff changeset
8388 purple_conversation_set_data(gtkconv->active_conv, "unseen-state", GINT_TO_POINTER(gtkconv->unseen_state));
04af21d4be27 Set PurpleConversation unseen-(count|state) in gtkconv_set_unseen, as conv_set_unseen only sets it for hidden_conv conversations. Fixes #8358
jcs@jcs.org
parents: 26878
diff changeset
8389
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8390 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
8391 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8392
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8393 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8394 * 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
8395 * 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
8396 * messages.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8397 */
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
8398 static gboolean
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8399 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
8400 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8401 PidginWindow *win = d;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8402 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
8403
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
8404 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
8405 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
8406
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8407 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8408 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8409
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8410 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8411 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
8412 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8413 static GdkCursor *cursor = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8414
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8415 gtkwin->in_drag = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8416
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8417 if (gtkwin->drag_leave_signal) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8418 g_signal_handler_disconnect(G_OBJECT(widget),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8419 gtkwin->drag_leave_signal);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8420 gtkwin->drag_leave_signal = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8421 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8422
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8423 if (cursor == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8424 cursor = gdk_cursor_new(GDK_FLEUR);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8425
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8426 /* Grab the pointer */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8427 gtk_grab_add(gtkwin->notebook);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8428 #ifndef _WIN32
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8429 /* 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
8430 always be true after a button press. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8431 if (!gdk_pointer_is_grabbed())
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8432 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8433 gdk_pointer_grab(gtkwin->notebook->window, FALSE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8434 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
8435 NULL, cursor, GDK_CURRENT_TIME);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8436 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8437
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8438 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8439 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
8440 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8441
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 * 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
8444 * drag to be initiated.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8445 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8446 if (win->in_predrag) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8447 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
8448 e->x_root >= win->drag_max_x ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8449 e->y_root < win->drag_min_y ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8450 e->y_root >= win->drag_max_y) {
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 win->in_predrag = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8453 notebook_init_grab(win, widget);
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 else { /* Otherwise, draw the arrows. */
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8457 PidginWindow *dest_win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8458 GtkNotebook *dest_notebook;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8459 GtkWidget *tab;
17112
bee4ea11e299 Fix the tab-dragging arrows in conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17111
diff changeset
8460 gint page_num;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8461 gboolean horiz_tabs = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8462 gboolean to_right = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8463
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8464 /* 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
8465 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
8466
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8467 if (dest_win == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8468 dnd_hints_hide_all();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8469
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8470 return TRUE;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8473 dest_notebook = GTK_NOTEBOOK(dest_win->notebook);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8474
22193
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
8475 if (gtk_notebook_get_show_tabs(dest_notebook)) {
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
8476 page_num = pidgin_conv_get_tab_at_xy(dest_win,
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
8477 e->x_root, e->y_root, &to_right);
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
8478 to_right = to_right && (win != dest_win);
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
8479 tab = pidgin_conv_window_get_gtkconv_at_index(dest_win, page_num)->tabby;
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
8480 } else {
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
8481 page_num = 0;
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
8482 to_right = pidgin_conv_xy_to_right_infopane(dest_win, e->x_root, e->y_root);
22733
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
8483 tab = pidgin_conv_window_get_gtkconv_at_index(dest_win, page_num)->infopane_hbox;
22193
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
8484 }
15374
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 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
8487 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
8488 horiz_tabs = TRUE;
bee4ea11e299 Fix the tab-dragging arrows in conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17111
diff changeset
8489 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8490
22193
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
8491 if (gtk_notebook_get_show_tabs(dest_notebook) == FALSE && win == dest_win)
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
8492 {
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
8493 /* dragging a tab from a single-tabbed window over its own window */
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
8494 dnd_hints_hide_all();
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
8495 return TRUE;
19235
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8496 } else if (horiz_tabs) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8497 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
8498 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
8499 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
8500 } else {
bee4ea11e299 Fix the tab-dragging arrows in conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17111
diff changeset
8501 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
8502 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
8503 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8504 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8505 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
8506 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
8507 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
8508 } else {
bee4ea11e299 Fix the tab-dragging arrows in conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17111
diff changeset
8509 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
8510 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
8511 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8512 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8513 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8514
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8515 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8516 }
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 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8519 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
8520 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8521 if (win->in_drag)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8522 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8523
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8524 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
8525 e->x_root >= win->drag_max_x ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8526 e->y_root < win->drag_min_y ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8527 e->y_root >= win->drag_max_y) {
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 win->in_predrag = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8530 notebook_init_grab(win, widget);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8531 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8532
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8533 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8534 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8535
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 * THANK YOU GALEON!
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8538 */
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
8539
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
8540 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
8541 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
8542 {
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
8543 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
8544 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
8545 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
8546 }
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
8547
18523
0a8f9829640f Show the 'send to' menu on right click on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18465
diff changeset
8548 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
8549 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
8550
19235
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8551 if (e->button == 1) {
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8552 int nb_x, nb_y;
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8553
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8554 if (gtkconv->win->in_drag)
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8555 return TRUE;
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8556
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8557 gtkconv->win->in_predrag = TRUE;
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8558 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
8559
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8560 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
8561
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8562 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
8563 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
8564 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
8565 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
8566
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8567 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
8568 G_CALLBACK(notebook_motion_cb), gtkconv->win);
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8569 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
8570 G_CALLBACK(notebook_leave_cb), gtkconv->win);
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8571 return FALSE;
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8572 }
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25362
diff changeset
8573
18523
0a8f9829640f Show the 'send to' menu on right click on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18465
diff changeset
8574 if (e->button == 3) {
21888
c88a3f2dbb52 Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
8575 /* Right click was pressed. Popup the context 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
8576 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
8577 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
8578 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
8579
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
8580 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
8581 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
8582 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
8583 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
8584 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
8585 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
8586 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
8587 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
8588 } 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
8589 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
8590 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
8591 }
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
8592
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
8593 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
8594 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
8595 return TRUE;
18671
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
8596 }
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
8597 return FALSE;
18671
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
8598 }
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25362
diff changeset
8599
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8600 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8601 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
8602 {
30863
351d07aefb09 Kill off many dead assignments and any useless remaining variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30579
diff changeset
8603 gint nb_x, nb_y;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8604 int tab_clicked;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8605 GtkWidget *page;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8606 GtkWidget *tab;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8607
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
8608 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
8609 PidginConversation *gtkconv;
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8610 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
8611
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8612 if (tab_clicked == -1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8613 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8614
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8615 gtkconv = pidgin_conv_window_get_gtkconv_at_index(win, tab_clicked);
30016
97005a2e99d7 Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents: 29750
diff changeset
8616 close_conv_cb(NULL, gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8617 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8618 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8619
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8620
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8621 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
8622 return FALSE;
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 if (win->in_drag) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8626 purple_debug(PURPLE_DEBUG_WARNING, "gtkconv",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8627 "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
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 * 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
8633 * mess things up.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8634 */
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8635 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
8636
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8637 if (tab_clicked == -1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8638 return FALSE;
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 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8641 * 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
8642 * the position of the notebook.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8643 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8644 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
8645
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8646 /* Reset the min/max x/y */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8647 win->drag_min_x = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8648 win->drag_min_y = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8649 win->drag_max_x = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8650 win->drag_max_y = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8651
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8652 /* Find out which tab was dragged. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8653 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
8654 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
8655
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8656 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
8657 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
8658 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
8659 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
8660
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8661 /* 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
8662 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
8663 e->x_root >= win->drag_max_x ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8664 e->y_root < win->drag_min_y ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8665 e->y_root >= win->drag_max_y) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8666
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8667 return FALSE;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8670 win->in_predrag = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8671 win->drag_tab = tab_clicked;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8672
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8673 /* Connect the new motion signals. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8674 win->drag_motion_signal =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8675 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
8676 G_CALLBACK(notebook_motion_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8677
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8678 win->drag_leave_signal =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8679 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
8680 G_CALLBACK(notebook_leave_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8681
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8682 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8683 }
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 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8686 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
8687 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8688 PidginWindow *dest_win;
22193
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
8689 GtkNotebook *dest_notebook;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8690 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8691 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8692 gint dest_page_num = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8693 gboolean new_window = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8694 gboolean to_right = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8695
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8696 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8697 * 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
8698 * 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
8699 * close button.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8700 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8701 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
8702 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8703
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8704 if (gdk_pointer_is_grabbed()) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8705 gdk_pointer_ungrab(GDK_CURRENT_TIME);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8706 gtk_grab_remove(widget);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8707 }
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 if (!win->in_predrag && !win->in_drag)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8710 return FALSE;
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 /* Disconnect the motion signal. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8713 if (win->drag_motion_signal) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8714 g_signal_handler_disconnect(G_OBJECT(widget),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8715 win->drag_motion_signal);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8716
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8717 win->drag_motion_signal = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8718 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8719
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 * 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
8722 * signal.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8723 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8724 if (win->in_predrag) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8725 win->in_predrag = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8726
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8727 if (win->drag_leave_signal) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8728 g_signal_handler_disconnect(G_OBJECT(widget),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8729 win->drag_leave_signal);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8730
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8731 win->drag_leave_signal = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8732 }
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8735 /* If we're not in drag... */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8736 /* We're perfectly normal people! */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8737 if (!win->in_drag)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8738 return FALSE;
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 win->in_drag = FALSE;
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 dnd_hints_hide_all();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8743
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8744 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
8745
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8746 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
8747
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8748 if (dest_win == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8749 /* 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
8750 * 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
8751 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
8752 /* 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
8753 dest_win = pidgin_conv_window_new();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8754 new_window = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8755 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8756 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8757
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8758 if (dest_win == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8759 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8760
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8761 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
8762 "conversation-dragging", win, dest_win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8763
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8764 /* Get the destination page number. */
22193
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
8765 if (!new_window) {
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
8766 dest_notebook = GTK_NOTEBOOK(dest_win->notebook);
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
8767 if (gtk_notebook_get_show_tabs(dest_notebook)) {
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
8768 dest_page_num = pidgin_conv_get_tab_at_xy(dest_win,
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
8769 e->x_root, e->y_root, &to_right);
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
8770 } else {
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
8771 dest_page_num = 0;
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
8772 to_right = pidgin_conv_xy_to_right_infopane(dest_win, e->x_root, e->y_root);
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
8773 }
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
8774 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8775
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8776 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
8777
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8778 if (win == dest_win) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8779 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
8780 } else {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8781 pidgin_conv_window_remove_gtkconv(win, gtkconv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8782 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
8783 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
8784 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
8785 if (new_window) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8786 gint win_width, win_height;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8787
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8788 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
8789 &win_width, &win_height);
22669
101d16be1521 Stop restoring conversation window locations on !Windows, I wasn't aware this
Etan Reisner <pidgin@unreliablesource.net>
parents: 22647
diff changeset
8790 #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
8791 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
8792 e->x_root - (win_width / 2),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8793 e->y_root - (win_height / 2));
19614
16776040e347 ifdef win32 the conversation placement code
Sean Egan <seanegan@gmail.com>
parents: 19600
diff changeset
8794 #endif
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8795
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8796 pidgin_conv_window_show(dest_win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8797 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8798 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8799
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8800 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
8801
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8802 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8803 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8804
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8805
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8806 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8807 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
8808 gpointer user_data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8809 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8810 PidginWindow *win;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8811 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8812 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8813
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8814 win = user_data;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8815 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
8816
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8817 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8818
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8819 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
8820 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8821
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8822 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8823
17278
591d6c3e9f1f Stop the typing icon timer before switching conversations so the typing
Stu Tomlinson <stu@nosnilmot.com>
parents: 17257
diff changeset
8824 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
8825 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
8826 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
8827 }
591d6c3e9f1f Stop the typing icon timer before switching conversations so the typing
Stu Tomlinson <stu@nosnilmot.com>
parents: 17257
diff changeset
8828
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8829 stop_anim(NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8830 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8831 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8832 close_window(GtkWidget *w, PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8833 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8834 close_win_cb(w, NULL, win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8835 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8836
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8837 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8838 detach_tab_cb(GtkWidget *w, GObject *menu)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8839 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8840 PidginWindow *win, *new_window;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8841 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8842
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8843 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
8844
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8845 if (!gtkconv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8846 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8847
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8848 win = pidgin_conv_get_window(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8849 /* 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
8850 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
8851 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8852
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8853 pidgin_conv_window_remove_gtkconv(win, gtkconv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8854
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8855 new_window = pidgin_conv_window_new();
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8856 pidgin_conv_window_add_gtkconv(new_window, gtkconv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8857 pidgin_conv_window_show(new_window);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8858 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8859
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8860 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8861 close_others_cb(GtkWidget *w, GObject *menu)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8862 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8863 GList *iter;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8864 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8865 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8866
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8867 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
8868
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8869 if (!gtkconv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8870 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8871
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8872 win = pidgin_conv_get_window(gtkconv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8873
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8874 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
8875 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8876 PidginConversation *gconv = iter->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8877 iter = iter->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8878
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8879 if (gconv != gtkconv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8880 {
30016
97005a2e99d7 Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents: 29750
diff changeset
8881 close_conv_cb(NULL, gconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8882 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8883 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8884 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8885
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8886 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
8887 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8888 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8889
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8890 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
8891
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8892 if (gtkconv)
30016
97005a2e99d7 Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents: 29750
diff changeset
8893 close_conv_cb(NULL, gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8894 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8895
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8896 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8897 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
8898 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8899 GtkWidget *item, *menu;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8900 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8901
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8902 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
8903 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8904
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8905 gtkconv = pidgin_conv_window_get_gtkconv_at_index(win,
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8906 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
8907
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8908 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
8909 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8910 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
8911 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8912 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8913
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8914 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
8915
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8916 menu = notebook->menu;
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
8917 pidgin_separator(GTK_WIDGET(menu));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8918
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8919 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
8920 gtk_widget_show(item);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8921 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
8922 g_signal_connect(G_OBJECT(item), "activate",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8923 G_CALLBACK(close_others_cb), menu);
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 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
8926 gtk_widget_show(item);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8927 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
8928 g_signal_connect(G_OBJECT(item), "activate",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8929 G_CALLBACK(close_window), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8930
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
8931 pidgin_separator(menu);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8932
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8933 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
8934 gtk_widget_show(item);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8935 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
8936 g_signal_connect(G_OBJECT(item), "activate",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8937 G_CALLBACK(detach_tab_cb), menu);
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 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
8940 gtk_widget_show(item);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8941 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
8942 g_signal_connect(G_OBJECT(item), "activate",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8943 G_CALLBACK(close_tab_cb), menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8944
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8945 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8946 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8947
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8948 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
8949 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
8950 {
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
8951 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
8952 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
8953 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
8954 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
8955 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
8956 }
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
8957
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
8958 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
8959 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
8960 {
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
8961 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
8962 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
8963 }
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
8964
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
8965 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
8966 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
8967 {
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
8968 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
8969 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
8970 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
8971 }
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
8972 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
8973 }
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
8974
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
8975 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
8976 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
8977 {
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
8978 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
8979 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
8980 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
8981 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
8982
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
8983 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
8984 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
8985 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
8986 }
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
8987 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
8988 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
8989 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
8990
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
8991 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
8992 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
8993 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
8994 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
8995 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
8996 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
8997 }
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
8998 serv_alias_buddy(buddy);
21731
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8999 } 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
9000 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
9001 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
9002 }
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
9003 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
9004 }
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
9005
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
9006 static gboolean
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
9007 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
9008 {
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
9009 GtkWidget *entry = NULL;
21731
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
9010 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
9011 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
9012
21951
800ede833f99 Patch from QuLogic to prevent multiple alias editing fields in the infopane. Fixes #4467.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21945
diff changeset
9013 if (!GTK_WIDGET_VISIBLE(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
9014 /* 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
9015 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
9016 }
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
9017
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
9018 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
9019 /* 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
9020 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
9021 }
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
9022
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
9023 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
9024 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
9025 if (!buddy)
21731
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
9026 /* 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
9027 return FALSE;
21731
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
9028
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
9029 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
9030 } 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
9031 PurpleConnection *gc;
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
9032 PurplePluginProtocolInfo *prpl_info = NULL;
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
9033
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
9034 gc = purple_conversation_get_gc(conv);
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
9035 if (gc != NULL)
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
9036 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
9037 if (prpl_info && prpl_info->set_chat_topic == NULL)
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
9038 /* 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
9039 return FALSE;
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
9040
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
9041 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
9042 }
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
9043
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
9044 /* 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
9045 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
9046 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
9047 gtk_entry_set_width_chars(GTK_ENTRY(entry), 10);
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
9048 gtk_entry_set_alignment(GTK_ENTRY(entry), 0.5);
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
9049
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
9050 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
9051 /* 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
9052 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
9053
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
9054 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
9055 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
9056 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
9057
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
9058 if (text != NULL)
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
9059 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
9060 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
9061 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
9062 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
9063
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
9064 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
9065 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
9066
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
9067 static gboolean
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
9068 window_keypress_cb(GtkWidget *widget, GdkEventKey *event, PidginWindow *win)
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
9069 {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
9070 PidginConversation *gtkconv = pidgin_conv_window_get_active_gtkconv(win);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
9071
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
9072 return conv_keypress_common(gtkconv, event);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
9073 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
9074
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
9075 static void
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9076 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
9077 gpointer user_data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9078 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9079 PidginWindow *win;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9080 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9081 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9082 const char *sound_method;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9083
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9084 win = user_data;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9085 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
9086 conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9087
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9088 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9089
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9090 /* clear unseen flag if conversation is not hidden */
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9091 if(!pidgin_conv_is_hidden(gtkconv)) {
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
9092 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
9093 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9094
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9095 /* Update the menubar */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9096
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9097 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
9098 purple_conversation_is_logging(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9099
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9100 generate_send_to_items(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9101 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
9102 regenerate_plugins_items(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9103
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9104 pidgin_conv_switch_active_conversation(conv);
15374
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 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
9107 if (strcmp(sound_method, "none") != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9108 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
9109 gtkconv->make_sound);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9110
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9111 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
9112 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
9113
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9114 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
9115 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
9116
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 * 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
9119 * 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
9120 */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9121 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
9122 (gtkconv->u.im->animate))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9123 start_anim(NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9124
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9125 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
9126 }
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 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9129 * GTK+ window ops
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9130 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9131
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9132 GList *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9133 pidgin_conv_windows_get_list()
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9134 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9135 return window_list;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9136 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9137
16315
ee4ce3c4186f Fix #248 (Control shouldn't steal focus from scrollback)
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16286
diff changeset
9138 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
9139 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
9140 {
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
9141 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
9142 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
9143 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
9144 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
9145 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
9146 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
9147 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
9148 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
9149 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
9150 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
9151 }
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
9152
16315
ee4ce3c4186f Fix #248 (Control shouldn't steal focus from scrollback)
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16286
diff changeset
9153 static void
ee4ce3c4186f Fix #248 (Control shouldn't steal focus from scrollback)
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16286
diff changeset
9154 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
9155 {
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
9156 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
9157 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
9158 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
9159 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
9160 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
9161 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
9162 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
9163 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
9164 }
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
9165
17392
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
9166 static void
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
9167 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
9168 {
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
9169 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
9170 }
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
9171
18328
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9172 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
9173 int x, y;
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25362
diff changeset
9174
18328
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9175 if (GTK_WIDGET_VISIBLE(w))
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9176 gtk_window_get_position(GTK_WINDOW(w), &x, &y);
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9177 else
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9178 return FALSE; /* carry on normally */
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9179
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9180 /* Workaround for GTK+ bug # 169811 - "configure_event" is fired
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9181 * when the window is being maximized */
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9182 if (gdk_window_get_state(w->window) & GDK_WINDOW_STATE_MAXIMIZED)
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9183 return FALSE;
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25362
diff changeset
9184
18328
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9185 /* don't save off-screen positioning */
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9186 if (x + event->width < 0 ||
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9187 y + event->height < 0 ||
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9188 x > gdk_screen_width() ||
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9189 y > gdk_screen_height())
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9190 return FALSE; /* carry on normally */
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9191
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9192 /* 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
9193 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
9194 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
9195 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
9196 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
9197
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9198 /* continue to handle event normally */
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9199 return FALSE;
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25362
diff changeset
9200
18328
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9201 }
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
9202
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
9203 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
9204 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
9205 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
9206 {
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
9207 /* 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
9208 * 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
9209 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
9210 !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
9211
30863
351d07aefb09 Kill off many dead assignments and any useless remaining variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30579
diff changeset
9212 #ifdef _WIN32 /* only override window manager placement on Windows */
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9213 /* ...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
9214 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
9215 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
9216 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
9217 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
9218
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9219 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
9220 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
9221 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
9222 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
9223
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9224 /* ...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
9225 gtk_window_move(GTK_WINDOW(win->window), conv_x, conv_y);
22669
101d16be1521 Stop restoring conversation window locations on !Windows, I wasn't aware this
Etan Reisner <pidgin@unreliablesource.net>
parents: 22647
diff changeset
9226 #endif
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9227 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
9228 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9229 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9230
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9231 static void
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9232 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
9233 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
9234 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
9235 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
9236 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
9237 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
9238 }
672dd03f538a More work on the conversation sizing/positioning stuff. Still nothing IM or chat specific
Sean Egan <seanegan@gmail.com>
parents: 18621
diff changeset
9239
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9240 PidginWindow *
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9241 pidgin_conv_window_new()
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9242 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9243 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9244 GtkPositionType pos;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9245 GtkWidget *testidea;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9246 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
9247 GdkModifierType state;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9248
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9249 win = g_malloc0(sizeof(PidginWindow));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9250
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9251 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
9252
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9253 /* Create the window. */
17166
92c3c2eeba87 Added to gtkutils.c:
Gabriel Schulhof <nix@go-nix.ca>
parents: 17116
diff changeset
9254 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
9255 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
9256 gtk_window_set_focus_on_map(GTK_WINDOW(win->window), FALSE);
29485
48ea900ee72a This should pretty much finish off the GTK_CHECK_VERSION calls in Pidgin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28364
diff changeset
9257
22669
101d16be1521 Stop restoring conversation window locations on !Windows, I wasn't aware this
Etan Reisner <pidgin@unreliablesource.net>
parents: 22647
diff changeset
9258 /* Etan: I really think this entire function call should happen only
101d16be1521 Stop restoring conversation window locations on !Windows, I wasn't aware this
Etan Reisner <pidgin@unreliablesource.net>
parents: 22647
diff changeset
9259 * when we are on Windows but I was informed that back before we used
101d16be1521 Stop restoring conversation window locations on !Windows, I wasn't aware this
Etan Reisner <pidgin@unreliablesource.net>
parents: 22647
diff changeset
9260 * to save the window position we stored the window size, so I'm
101d16be1521 Stop restoring conversation window locations on !Windows, I wasn't aware this
Etan Reisner <pidgin@unreliablesource.net>
parents: 22647
diff changeset
9261 * leaving it for now. */
101d16be1521 Stop restoring conversation window locations on !Windows, I wasn't aware this
Etan Reisner <pidgin@unreliablesource.net>
parents: 22647
diff changeset
9262 #if TRUE || defined(_WIN32)
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
9263 pidgin_conv_restore_position(win);
22669
101d16be1521 Stop restoring conversation window locations on !Windows, I wasn't aware this
Etan Reisner <pidgin@unreliablesource.net>
parents: 22647
diff changeset
9264 #endif
17260
baaf2cf9339c disapproval of revision '1f819f5ad330efa81ac7906f854b46f0c8bbd7b6'
Ethan Blanton <elb@pidgin.im>
parents: 17259
diff changeset
9265
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
9266 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
9267 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
9268 }
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
9269
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9270 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
9271 G_CALLBACK(close_win_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9272 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
9273 G_CALLBACK(focus_win_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9274
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
9275 /* Intercept keystrokes from the menu items */
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
9276 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
9277 G_CALLBACK(window_keypress_cb), win);
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25362
diff changeset
9278
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
9279
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9280 /* Create the notebook. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9281 win->notebook = gtk_notebook_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9282
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
9283 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
9284
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9285 #if 0
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9286 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
9287 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
9288 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9289 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
9290 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
9291 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
9292 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
9293 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
9294
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9295 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
9296 G_CALLBACK(right_click_menu_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9297
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9298 gtk_widget_show(win->notebook);
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 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
9301 G_CALLBACK(before_switch_conv_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9302 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
9303 G_CALLBACK(switch_conv_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9304
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9305 /* Setup the tab drag and drop signals. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9306 gtk_widget_add_events(win->notebook,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9307 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
9308 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
9309 G_CALLBACK(notebook_press_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9310 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
9311 G_CALLBACK(notebook_release_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9312
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9313 testidea = gtk_vbox_new(FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9314
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9315 /* Setup the menubar. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9316 menubar = setup_menubar(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9317 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
9318
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9319 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
9320
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9321 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
9322
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9323 gtk_widget_show(testidea);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9324
17392
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
9325 /* 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
9326 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
9327 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
9328 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
9329 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
9330
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
9331
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9332 #ifdef _WIN32
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9333 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
9334 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
9335
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
9336 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
9337 && !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
9338 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
9339 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9340
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9341 return win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9342 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9343
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9344 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9345 pidgin_conv_window_destroy(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9346 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9347 purple_prefs_disconnect_by_handle(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9348 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
9349
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9350 /* 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
9351 if (win->dialogs.search)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9352 gtk_widget_destroy(win->dialogs.search);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9353
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9354 if (win->gtkconvs) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9355 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
9356 gboolean last = (win->gtkconvs->next == NULL);
30016
97005a2e99d7 Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents: 29750
diff changeset
9357 close_conv_cb(NULL, win->gtkconvs->data);
20077
fee0eea83e58 Honour the persistency when closing the window from the WM.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20051
diff changeset
9358 if (last)
fee0eea83e58 Honour the persistency when closing the window from the WM.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20051
diff changeset
9359 break;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9360 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9361 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9362 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9363 gtk_widget_destroy(win->window);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9364
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9365 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
9366
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9367 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
9368 purple_signals_disconnect_by_handle(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9369
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9370 g_free(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9371 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9372
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9373 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9374 pidgin_conv_window_show(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9375 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9376 gtk_widget_show(win->window);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9377 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9378
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9379 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9380 pidgin_conv_window_hide(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9381 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9382 gtk_widget_hide(win->window);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9383 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9384
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9385 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9386 pidgin_conv_window_raise(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9387 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9388 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
9389 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9390
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9391 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9392 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
9393 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9394 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
9395 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
9396 gtkconv->tab_cont));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9397 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9398
18864
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9399 static gboolean
29307
9c3e0f2e82ea Show tooltip for ellipsized tab titles.
Federico Mena Quintero <federico@novell.com>
parents: 29282
diff changeset
9400 gtkconv_tab_set_tip(GtkWidget *widget, GdkEventCrossing *event, PidginConversation *gtkconv)
9c3e0f2e82ea Show tooltip for ellipsized tab titles.
Federico Mena Quintero <federico@novell.com>
parents: 29282
diff changeset
9401 {
9c3e0f2e82ea Show tooltip for ellipsized tab titles.
Federico Mena Quintero <federico@novell.com>
parents: 29282
diff changeset
9402 #if GTK_CHECK_VERSION(2, 12, 0)
9c3e0f2e82ea Show tooltip for ellipsized tab titles.
Federico Mena Quintero <federico@novell.com>
parents: 29282
diff changeset
9403 #define gtk_tooltips_set_tip(tips, w, l, p) gtk_widget_set_tooltip_text(w, l)
9c3e0f2e82ea Show tooltip for ellipsized tab titles.
Federico Mena Quintero <federico@novell.com>
parents: 29282
diff changeset
9404 #endif
29392
4863fed15aa2 Do a version-check for pango.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29387
diff changeset
9405 /* PANGO_VERSION_CHECK macro was introduced in 1.15. So we need this double check. */
4863fed15aa2 Do a version-check for pango.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29387
diff changeset
9406 #ifndef PANGO_VERSION_CHECK
4863fed15aa2 Do a version-check for pango.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29387
diff changeset
9407 #define pango_layout_is_ellipsized(l) TRUE
4863fed15aa2 Do a version-check for pango.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29387
diff changeset
9408 #elif !PANGO_VERSION_CHECK(1,16,0)
4863fed15aa2 Do a version-check for pango.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29387
diff changeset
9409 #define pango_layout_is_ellipsized(l) TRUE
4863fed15aa2 Do a version-check for pango.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29387
diff changeset
9410 #endif
29307
9c3e0f2e82ea Show tooltip for ellipsized tab titles.
Federico Mena Quintero <federico@novell.com>
parents: 29282
diff changeset
9411 PangoLayout *layout;
9c3e0f2e82ea Show tooltip for ellipsized tab titles.
Federico Mena Quintero <federico@novell.com>
parents: 29282
diff changeset
9412
9c3e0f2e82ea Show tooltip for ellipsized tab titles.
Federico Mena Quintero <federico@novell.com>
parents: 29282
diff changeset
9413 layout = gtk_label_get_layout(GTK_LABEL(gtkconv->tab_label));
9c3e0f2e82ea Show tooltip for ellipsized tab titles.
Federico Mena Quintero <federico@novell.com>
parents: 29282
diff changeset
9414 gtk_tooltips_set_tip(gtkconv->tooltips, widget,
9c3e0f2e82ea Show tooltip for ellipsized tab titles.
Federico Mena Quintero <federico@novell.com>
parents: 29282
diff changeset
9415 pango_layout_is_ellipsized(layout) ? gtk_label_get_text(GTK_LABEL(gtkconv->tab_label)) : NULL,
9c3e0f2e82ea Show tooltip for ellipsized tab titles.
Federico Mena Quintero <federico@novell.com>
parents: 29282
diff changeset
9416 NULL);
9c3e0f2e82ea Show tooltip for ellipsized tab titles.
Federico Mena Quintero <federico@novell.com>
parents: 29282
diff changeset
9417 return FALSE;
9c3e0f2e82ea Show tooltip for ellipsized tab titles.
Federico Mena Quintero <federico@novell.com>
parents: 29282
diff changeset
9418 #if GTK_CHECK_VERSION(2, 12, 0)
9c3e0f2e82ea Show tooltip for ellipsized tab titles.
Federico Mena Quintero <federico@novell.com>
parents: 29282
diff changeset
9419 #undef gtk_tooltips_set_tip
9c3e0f2e82ea Show tooltip for ellipsized tab titles.
Federico Mena Quintero <federico@novell.com>
parents: 29282
diff changeset
9420 #endif
9c3e0f2e82ea Show tooltip for ellipsized tab titles.
Federico Mena Quintero <federico@novell.com>
parents: 29282
diff changeset
9421 }
9c3e0f2e82ea Show tooltip for ellipsized tab titles.
Federico Mena Quintero <federico@novell.com>
parents: 29282
diff changeset
9422
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9423 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9424 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
9425 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9426 PurpleConversation *conv = gtkconv->active_conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9427 PidginConversation *focus_gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9428 GtkWidget *tab_cont = gtkconv->tab_cont;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9429 PurpleConversationType conv_type;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9430 const gchar *tmp_lab;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9431
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9432 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
9433
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9434 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
9435 gtkconv->win = win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9436
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25362
diff changeset
9437 if (win->gtkconvs && win->gtkconvs->next && win->gtkconvs->next->next == 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
9438 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
9439
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
9440
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9441 /* Close button. */
30134
0625cebc84d7 Use cute little "¡ß" on the close buttons in conversation tabs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 30020
diff changeset
9442 gtkconv->close = pidgin_create_small_button(gtk_label_new("×"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9443 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
9444 _("Close conversation"), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9445
30016
97005a2e99d7 Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents: 29750
diff changeset
9446 g_signal_connect(gtkconv->close, "clicked", G_CALLBACK (close_conv_cb), gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9447
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9448 /* Status icon. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9449 gtkconv->icon = gtk_image_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9450 gtkconv->menu_icon = gtk_image_new();
26727
dbe2731f0a35 Use stock-id in the conversation tab-labels and tab-menus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26725
diff changeset
9451 g_object_set(G_OBJECT(gtkconv->icon),
dbe2731f0a35 Use stock-id in the conversation tab-labels and tab-menus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26725
diff changeset
9452 "icon-size", gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_MICROSCOPIC),
dbe2731f0a35 Use stock-id in the conversation tab-labels and tab-menus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26725
diff changeset
9453 NULL);
dbe2731f0a35 Use stock-id in the conversation tab-labels and tab-menus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26725
diff changeset
9454 g_object_set(G_OBJECT(gtkconv->menu_icon),
dbe2731f0a35 Use stock-id in the conversation tab-labels and tab-menus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26725
diff changeset
9455 "icon-size", gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_MICROSCOPIC),
dbe2731f0a35 Use stock-id in the conversation tab-labels and tab-menus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26725
diff changeset
9456 NULL);
19291
c003aa584909 Remove truncation until we can do it smarter
Sean Egan <seanegan@gmail.com>
parents: 19290
diff changeset
9457 gtk_widget_show(gtkconv->icon);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9458 update_tab_icon(conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9459
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9460 /* Tab label. */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9461 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
9462 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
9463
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9464 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
9465 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
9466 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
9467
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9468 gtk_widget_show_all(gtkconv->menu_icon);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9469
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9470 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
9471 gtk_widget_show(gtkconv->menu_label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9472 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
9473
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9474 gtk_widget_show(gtkconv->menu_tabby);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9475
30863
351d07aefb09 Kill off many dead assignments and any useless remaining variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30579
diff changeset
9476 if (conv_type == PURPLE_CONV_TYPE_IM)
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9477 pidgin_conv_update_buddy_icon(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9478
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9479 /* Build and set conversations tab */
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9480 pidgin_conv_tab_pack(win, gtkconv);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9481
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9482 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
9483
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9484 gtk_widget_show(tab_cont);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9485
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9486 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
9487 /* 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
9488 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
9489 } else {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9490 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
9491 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9492
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9493 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
9494 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
9495 gtk_widget_grab_focus(focus_gtkconv->entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9496
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9497 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
9498 update_send_to_selection(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9499 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9500
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9501 static void
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9502 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
9503 {
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9504 gboolean tabs_side = FALSE;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9505 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
9506 GtkWidget *first, *third, *ebox;
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9507
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9508 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
9509 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
9510 tabs_side = TRUE;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9511 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
9512 angle = 90;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9513 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
9514 angle = 270;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9515
19361
272d08484f7d remove obsolote GNOME color pallete
Sean Egan <seanegan@gmail.com>
parents: 19335
diff changeset
9516 if (!angle) {
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9517 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
9518 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
9519 } else {
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9520 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
9521 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
9522 }
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
9523
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9524 if (tabs_side) {
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9525 gtk_label_set_width_chars(
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9526 GTK_LABEL(gtkconv->tab_label),
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9527 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
9528 );
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9529 }
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
9530
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
9531 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
9532
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9533 #if 0
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9534 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
9535 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
9536 #endif
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9537
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9538 if (angle)
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9539 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
9540 else
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9541 gtkconv->tabby = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
21896
31a48cbc5e12 This fixes the tab-coloring issue that's been bugging seanegn.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21894
diff changeset
9542 gtk_widget_set_name(gtkconv->tabby, "tab-container");
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9543
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9544 /* select the correct ordering for verticle tabs */
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9545 if (angle == 90) {
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9546 first = gtkconv->close;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9547 third = gtkconv->icon;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9548 } else {
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9549 first = gtkconv->icon;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9550 third = gtkconv->close;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9551 }
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9552
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
9553 ebox = gtk_event_box_new();
17116
80350acaa289 Fix background color issues in the coversation tabs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17112
diff changeset
9554 gtk_event_box_set_visible_window(GTK_EVENT_BOX(ebox), FALSE);
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
9555 gtk_container_add(GTK_CONTAINER(ebox), gtkconv->tabby);
29307
9c3e0f2e82ea Show tooltip for ellipsized tab titles.
Federico Mena Quintero <federico@novell.com>
parents: 29282
diff changeset
9556 g_signal_connect(G_OBJECT(ebox), "enter-notify-event",
9c3e0f2e82ea Show tooltip for ellipsized tab titles.
Federico Mena Quintero <federico@novell.com>
parents: 29282
diff changeset
9557 G_CALLBACK(gtkconv_tab_set_tip), 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
9558
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9559 if (gtkconv->tab_label->parent == NULL) {
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9560 /* Pack if it's a new widget */
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9561 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
9562 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
9563 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
9564
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9565 /* 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
9566 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
9567 } else {
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9568 /* reparent old widgets on preference changes */
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9569 gtk_widget_reparent(first, gtkconv->tabby);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9570 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
9571 gtk_widget_reparent(third, gtkconv->tabby);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9572 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
9573 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
9574 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
9575
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9576 /* 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
9577 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
9578 }
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9579
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25362
diff changeset
9580 gtk_notebook_set_tab_label_packing(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont,
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25362
diff changeset
9581 !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
9582 TRUE, GTK_PACK_START);
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9583
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25362
diff changeset
9584 if (pidgin_conv_window_get_gtkconv_count(win) == 1)
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
9585 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
9586 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
9587 (!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
9588 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
9589
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9590 /* 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
9591 /* gtk_widget_show(gtkconv->icon); */
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9592 gtk_widget_show(gtkconv->tab_label);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9593 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
9594 gtk_widget_show(gtkconv->close);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9595 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
9596 gtk_widget_show(ebox);
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9597 }
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9598
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9599 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9600 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
9601 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9602 unsigned int index;
30863
351d07aefb09 Kill off many dead assignments and any useless remaining variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30579
diff changeset
9603
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9604 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
9605
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9606 g_object_ref(gtkconv->tab_cont);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9607 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
9608
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9609 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
9610
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9611 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
9612
19681
c35e8c057441 Fix a crash in window-placement.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19680
diff changeset
9613 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
9614 0, 0, NULL, NULL, gtkconv);
c35e8c057441 Fix a crash in window-placement.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19680
diff changeset
9615
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
9616 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
9617 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
9618
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9619 if (!win->gtkconvs && win != hidden_convwin)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9620 pidgin_conv_window_destroy(win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9621 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9622
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9623 PidginConversation *
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9624 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
9625 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9626 GtkWidget *tab_cont;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9627
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9628 if (index == -1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9629 index = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9630 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
9631 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
9632 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9633
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9634 PidginConversation *
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9635 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
9636 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9637 int index;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9638 GtkWidget *tab_cont;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9639
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9640 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
9641 if (index == -1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9642 index = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9643 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
9644 if (!tab_cont)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9645 return NULL;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9646 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
9647 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9648
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9649
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9650 PurpleConversation *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9651 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
9652 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9653 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9654
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9655 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
9656 return gtkconv ? gtkconv->active_conv : NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9657 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9658
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9659 gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9660 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
9661 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9662 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
9663 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9664
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9665 gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9666 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
9667 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9668 gboolean has_focus = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9669
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9670 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
9671
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9672 return has_focus;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9673 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9674
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9675 PidginWindow *
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9676 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
9677 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9678 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9679 GdkWindow *gdkwin;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9680 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9681
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9682 gdkwin = gdk_window_at_pointer(&x, &y);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9683
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9684 if (gdkwin)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9685 gdkwin = gdk_window_get_toplevel(gdkwin);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9686
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9687 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
9688 win = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9689
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9690 if (gdkwin == win->window->window)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9691 return win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9692 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9693
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9694 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9695 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9696
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9697 GList *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9698 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
9699 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9700 return win->gtkconvs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9701 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9702
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9703 guint
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9704 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
9705 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9706 return g_list_length(win->gtkconvs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9707 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9708
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9709 PidginWindow *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9710 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
9711 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9712 GList *wins, *convs;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9713 PidginWindow *win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9714 PidginConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9715
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9716 if (type == PURPLE_CONV_TYPE_UNKNOWN)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9717 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9718
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9719 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
9720 win = wins->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9721
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9722 for (convs = win->gtkconvs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9723 convs != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9724 convs = convs->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9725
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9726 conv = convs->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9727
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9728 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
9729 return win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9730 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9731 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9732
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9733 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9734 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9735
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9736 PidginWindow *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9737 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
9738 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9739 GList *wins, *convs;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9740 PidginWindow *win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9741 PidginConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9742
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9743 if (type == PURPLE_CONV_TYPE_UNKNOWN)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9744 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9745
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9746 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
9747 wins != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9748 wins = wins->prev) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9749
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9750 win = wins->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9751
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9752 for (convs = win->gtkconvs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9753 convs != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9754 convs = convs->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9755
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9756 conv = convs->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9757
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9758 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
9759 return win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9760 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9761 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9762
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9763 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9764 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9765
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 * Conversation placement functions
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 typedef struct
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 char *id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9773 char *name;
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
9774 PidginConvPlacementFunc fnc;
15374
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 } ConvPlacementData;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9777
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9778 static GList *conv_placement_fncs = NULL;
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
9779 static PidginConvPlacementFunc place_conv = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9780
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9781 /* 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
9782 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9783 conv_placement_last_created_win(PidginConversation *conv)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9784 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9785 PidginWindow *win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9786
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9787 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
9788 win = l ? l->data : NULL;;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9789
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9790 if (win == NULL) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9791 win = pidgin_conv_window_new();
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9792
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25362
diff changeset
9793 g_signal_connect(G_OBJECT(win->window), "configure_event",
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9794 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
9795
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9796 pidgin_conv_window_add_gtkconv(win, conv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9797 pidgin_conv_window_show(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9798 } else {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9799 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
9800 }
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9803 /* 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
9804 static gboolean
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9805 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
9806 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
9807 {
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25362
diff changeset
9808 int x, y;
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9809 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
9810 GList *all;
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9811
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9812 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
9813 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
9814 else
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9815 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
9816
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9817 /* 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
9818 * 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
9819 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
9820 return FALSE;
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25362
diff changeset
9821
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9822 /* 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
9823 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
9824 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
9825 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
9826 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
9827 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
9828
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9829 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
9830 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
9831 /* 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
9832 return FALSE;
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9833 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9834 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9835
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9836 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
9837 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
9838 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
9839 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
9840 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
9841 } 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
9842 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
9843 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
9844 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
9845 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
9846 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9847
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9848 return FALSE;
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9849 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9850
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9851 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9852 conv_placement_last_created_win_type(PidginConversation *conv)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9853 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9854 PidginWindow *win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9855
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9856 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
9857
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9858 if (win == NULL) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9859 win = pidgin_conv_window_new();
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9860
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9861 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
9862 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
9863 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
9864 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
9865 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
9866 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
9867 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
9868 } 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
9869 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
9870 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
9871 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
9872 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
9873 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
9874 }
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25362
diff changeset
9875
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9876 pidgin_conv_window_add_gtkconv(win, conv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9877 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
9878
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25362
diff changeset
9879 g_signal_connect(G_OBJECT(win->window), "configure_event",
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9880 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
9881 } else
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9882 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
9883 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9884
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9885 /* 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
9886 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9887 conv_placement_new_window(PidginConversation *conv)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9888 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9889 PidginWindow *win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9890
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9891 win = pidgin_conv_window_new();
18791
f36fc45b7866 really make restoring size and position work
Ka-Hing Cheung <khc@hxbc.us>
parents: 18790
diff changeset
9892
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25362
diff changeset
9893 g_signal_connect(G_OBJECT(win->window), "configure_event",
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9894 G_CALLBACK(gtk_conv_configure_cb), NULL);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9895
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9896 pidgin_conv_window_add_gtkconv(win, conv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9897
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9898 pidgin_conv_window_show(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9899 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9900
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9901 static PurpleGroup *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9902 conv_get_group(PidginConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9903 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9904 PurpleGroup *group = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9905
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9906 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
9907 PurpleBuddy *buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9908
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9909 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
9910 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
9911
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9912 if (buddy != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9913 group = purple_buddy_get_group(buddy);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9914
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9915 } 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
9916 PurpleChat *chat;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9917
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9918 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
9919 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
9920
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9921 if (chat != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9922 group = purple_chat_get_group(chat);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9923 }
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 return group;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9926 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9927
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 * 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
9930 * 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
9931 * open windows will get a new window.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9932 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9933 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9934 conv_placement_by_group(PidginConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9935 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9936 PurpleGroup *group = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9937 GList *wl, *cl;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9938
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9939 group = conv_get_group(conv);
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 /* 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
9942 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
9943 PidginWindow *win2;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9944 PidginConversation *conv2;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9945 PurpleGroup *group2 = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9946
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9947 win2 = wl->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9948
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9949 for (cl = win2->gtkconvs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9950 cl != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9951 cl = cl->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9952 conv2 = cl->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9953
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9954 group2 = conv_get_group(conv2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9955
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9956 if (group == group2) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9957 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
9958
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9959 return;
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 }
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9964 /* Make a new window. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9965 conv_placement_new_window(conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9966 }
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 /* 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
9969 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9970 conv_placement_by_account(PidginConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9971 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9972 GList *wins, *convs;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9973 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9974
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9975 account = purple_conversation_get_account(conv->active_conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9976
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9977 /* 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
9978 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
9979 PidginWindow *win2;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9980 PidginConversation *conv2;
15374
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 win2 = wins->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9983
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9984 for (convs = win2->gtkconvs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9985 convs != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9986 convs = convs->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9987 conv2 = convs->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9988
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9989 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
9990 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
9991 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9992 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9993 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9994 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9995
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9996 /* Make a new window. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9997 conv_placement_new_window(conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9998 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9999
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10000 static ConvPlacementData *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10001 get_conv_placement_data(const char *id)
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 ConvPlacementData *data = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10004 GList *n;
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 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
10007 data = n->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10008 if (!strcmp(data->id, id))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10009 return data;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10012 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10013 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10014
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10015 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10016 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
10017 PidginConvPlacementFunc fnc)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10018 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10019 ConvPlacementData *data;
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 data = g_new(ConvPlacementData, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10022
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10023 data->id = g_strdup(id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10024 data->name = g_strdup(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10025 data->fnc = fnc;
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 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
10028 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10029
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10030 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10031 ensure_default_funcs(void)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10032 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10033 if (conv_placement_fncs == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10034 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
10035 conv_placement_last_created_win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10036 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
10037 conv_placement_last_created_win_type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10038 add_conv_placement_fnc("new", _("New window"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10039 conv_placement_new_window);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10040 add_conv_placement_fnc("group", _("By group"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10041 conv_placement_by_group);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10042 add_conv_placement_fnc("account", _("By account"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10043 conv_placement_by_account);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10044 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10045 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10046
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10047 GList *
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
10048 pidgin_conv_placement_get_options(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10049 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10050 GList *n, *list = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10051 ConvPlacementData *data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10052
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10053 ensure_default_funcs();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10054
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10055 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
10056 data = n->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10057 list = g_list_append(list, data->name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10058 list = g_list_append(list, data->id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10059 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10060
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10061 return list;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10062 }
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10065 void
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
10066 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
10067 PidginConvPlacementFunc fnc)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10068 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10069 g_return_if_fail(id != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10070 g_return_if_fail(name != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10071 g_return_if_fail(fnc != NULL);
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 ensure_default_funcs();
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 add_conv_placement_fnc(id, name, fnc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10076 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10077
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10078 void
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
10079 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
10080 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10081 ConvPlacementData *data = get_conv_placement_data(id);
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 if (data == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10084 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10085
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10086 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
10087
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10088 g_free(data->id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10089 g_free(data->name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10090 g_free(data);
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 const char *
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
10094 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
10095 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10096 ConvPlacementData *data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10097
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10098 ensure_default_funcs();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10099
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10100 data = get_conv_placement_data(id);
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 if (data == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10103 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10104
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10105 return data->name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10106 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10107
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
10108 PidginConvPlacementFunc
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
10109 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
10110 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10111 ConvPlacementData *data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10112
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10113 ensure_default_funcs();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10114
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10115 data = get_conv_placement_data(id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10116
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10117 if (data == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10118 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10119
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10120 return data->fnc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10121 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10122
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10123 void
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
10124 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
10125 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10126 g_return_if_fail(func != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10127
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10128 /* 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
10129 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
10130 place_conv = func;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10131 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10132 place_conv = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10133 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10134
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
10135 PidginConvPlacementFunc
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
10136 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
10137 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10138 return place_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10139 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10140
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10141 void
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
10142 pidgin_conv_placement_place(PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10143 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10144 if (place_conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10145 place_conv(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10146 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10147 conv_placement_new_window(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10148 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10149
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10150 gboolean
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
10151 pidgin_conv_is_hidden(PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10152 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10153 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
10154
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10155 return (gtkconv->win == hidden_convwin);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10156 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10157
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10158
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10159 /* 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
10160 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10161 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
10162 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10163 gulong fg_brightness;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10164 gulong bg_brightness;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10165 gulong br_diff;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10166 gulong col_diff;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10167 int fred, fgreen, fblue, bred, bgreen, bblue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10168
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10169 /* 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
10170 * 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
10171 * 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
10172 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10173
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10174 fred = foreground.red >> 8 ;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10175 fgreen = foreground.green >> 8 ;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10176 fblue = foreground.blue >> 8 ;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10177
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10178
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10179 bred = background.red >> 8 ;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10180 bgreen = background.green >> 8 ;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10181 bblue = background.blue >> 8 ;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10182
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10183 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
10184 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
10185 br_diff = abs(fg_brightness - bg_brightness);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10186
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10187 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
10188
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10189 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
10190 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10191
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10192
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10193 static GdkColor*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10194 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
10195 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10196 guint numcolors = *color_count;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10197 guint i = 0, j = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10198 GdkColor *colors = g_new(GdkColor, numcolors);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10199 GdkColor nick_highlight;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10200 GdkColor send_color;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10201 time_t breakout_time;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10202
21840
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
10203 gdk_color_parse(DEFAULT_HIGHLIGHT_COLOR, &nick_highlight);
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
10204 gdk_color_parse(DEFAULT_SEND_COLOR, &send_color);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10205
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10206 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
10207
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10208 breakout_time = time(NULL) + 3;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10209
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10210 /* 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
10211 * 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
10212 * numcolors of them that do
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10213 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10214 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
10215 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10216 GdkColor color = nick_seed_colors[j];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10217
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10218 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
10219 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
10220 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
10221 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10222 colors[i] = color;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10223 i++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10224 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10225 j++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10226 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10227
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10228 /* 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
10229 * 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
10230 * 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
10231 * conflict with each other.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10232 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10233 while(i < numcolors && time(NULL) < breakout_time)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10234 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10235 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
10236
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10237 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
10238 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
10239 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
10240 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10241 colors[i] = color;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10242 i++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10243 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10244 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10245
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10246 if (i < numcolors) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10247 GdkColor *c = colors;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
10248 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
10249 colors = g_memdup(c, i * sizeof(GdkColor));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10250 g_free(c);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10251 *color_count = i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10252 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10253
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10254 return colors;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10255 }