annotate pidgin/gtkconv.c @ 23849:2f588ade5236

Oops, missed a bit of that patch there. References #3590.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Tue, 19 Aug 2008 00:24:53 +0000
parents ca3dc911bf52
children a0381a68ceef f89bdd34c9f1 e187fdccd743
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2 * @file gtkconv.c GTK+ Conversation API
16193
247e421c4fa6 Rename the Doxygen group from gtkui to pidgin.
Richard Laager <rlaager@wiktel.com>
parents: 16084
diff changeset
3 * @ingroup pidgin
20251
6b8bc3309ab7 applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@wiktel.com>
parents: 20199
diff changeset
4 */
6b8bc3309ab7 applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@wiktel.com>
parents: 20199
diff changeset
5
6b8bc3309ab7 applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@wiktel.com>
parents: 20199
diff changeset
6 /* pidgin
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 *
15871
66dff3dfdea6 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
8 * Pidgin is the legal property of its developers, whose names are too numerous
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 * source distribution.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 * (at your option) any later version.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 * GNU General Public License for more details.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
19680
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19668
diff changeset
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27 #include "internal.h"
15514
535f002e7b0f More pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15509
diff changeset
28 #include "pidgin.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 #ifndef _WIN32
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 # include <X11/Xlib.h>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34 #ifdef USE_GTKSPELL
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35 # include <gtkspell/gtkspell.h>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 # ifdef _WIN32
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37 # include "wspell.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38 # endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41 #include <gdk/gdkkeysyms.h>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43 #include "account.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44 #include "cmds.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45 #include "debug.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46 #include "idle.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47 #include "imgstore.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48 #include "log.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49 #include "notify.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50 #include "prpl.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51 #include "request.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52 #include "util.h"
17846
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
53 #include "version.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55 #include "gtkdnd-hints.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
56 #include "gtkblist.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57 #include "gtkconv.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58 #include "gtkconvwin.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59 #include "gtkdialogs.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60 #include "gtkimhtml.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
61 #include "gtkimhtmltoolbar.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
62 #include "gtklog.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
63 #include "gtkmenutray.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
64 #include "gtkpounce.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65 #include "gtkprefs.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
66 #include "gtkprivacy.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
67 #include "gtkthemes.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
68 #include "gtkutils.h"
15822
84b0f9b23ede According to etags, pidgin/ should be completely clean of references to 'gaim' as a client
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
69 #include "pidginstock.h"
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
70 #include "pidgintooltip.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
71
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72 #include "gtknickcolors.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73
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
74 #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
75
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
76 #define AUTO_RESPONSE "&lt;AUTO-REPLY&gt; : "
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
77
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
78 typedef enum
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
79 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
80 PIDGIN_CONV_SET_TITLE = 1 << 0,
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
81 PIDGIN_CONV_BUDDY_ICON = 1 << 1,
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
82 PIDGIN_CONV_MENU = 1 << 2,
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
83 PIDGIN_CONV_TAB_ICON = 1 << 3,
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
84 PIDGIN_CONV_TOPIC = 1 << 4,
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
85 PIDGIN_CONV_SMILEY_THEME = 1 << 5,
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
86 PIDGIN_CONV_COLORIZE_TITLE = 1 << 6
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
87 }PidginConvFields;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
88
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
89 enum {
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
90 CONV_ICON_COLUMN,
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
91 CONV_TEXT_COLUMN,
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
92 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
93 CONV_PROTOCOL_ICON_COLUMN,
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
94 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
95 } 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
96
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
97 #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
98
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
99 /* 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
100 * 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
101 #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
102 #define DEFAULT_HIGHLIGHT_COLOR "#AF7F00"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103
22733
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
104 #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
105 #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
106
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 /* 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
108 #define DEBUG_CUSTOM_SMILEY
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110 #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
111
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 /* 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
113 #define MIN_BRIGHTNESS_CONTRAST 75
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 #define MIN_COLOR_CONTRAST 200
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116 #define NUM_NICK_COLORS 220
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117 static GdkColor *nick_colors = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118 static guint nbr_nick_colors;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
120 typedef struct {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121 GtkWidget *window;
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 GtkWidget *entry;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124 GtkWidget *message;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
126 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128 } InviteBuddyInfo;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130 static GtkWidget *invite_dialog = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131 static GtkWidget *warn_close_dialog = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
133 static PidginWindow *hidden_convwin = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 static GList *window_list = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
136 /* 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
137 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
138 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
139 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
140 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
141 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
142 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
143 static GList *offline_list = NULL;
15724
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
144 static GHashTable *prpl_lists = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
145
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
146 static gboolean update_send_to_selection(PidginWindow *win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
147 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
148
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
149 /* Prototypes. <-- because Paco-Paco hates this comment. */
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
150 static gboolean infopane_entry_activate(PidginConversation *gtkconv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
151 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
152 static void gray_stuff_out(PidginConversation *gtkconv);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
153 static void add_chat_buddy_common(PurpleConversation *conv, PurpleConvChatBuddy *cb, const char *old_name);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
154 static gboolean tab_complete(PurpleConversation *conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
155 static void pidgin_conv_updated(PurpleConversation *conv, PurpleConvUpdateType type);
20953
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
156 static void conv_set_unseen(PurpleConversation *gtkconv, PidginUnseenState state);
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
157 static void gtkconv_set_unseen(PidginConversation *gtkconv, PidginUnseenState state);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
158 static void update_typing_icon(PidginConversation *gtkconv);
21875
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
159 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
160 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
161 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
162 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
163 static gboolean color_is_visible(GdkColor foreground, GdkColor background, int color_contrast, int brightness_contrast);
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
164 static GtkTextTag *get_buddy_tag(PurpleConversation *conv, const char *who, gboolean create);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
165 static void pidgin_conv_update_fields(PurpleConversation *conv, PidginConvFields fields);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
166 static void focus_out_from_menubar(GtkWidget *wid, PidginWindow *win);
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
167 static void pidgin_conv_tab_pack(PidginWindow *win, PidginConversation *gtkconv);
18227
cbc89a49e43b Treat infopanes just like tabs for purposes of drag-and-drop. Then, don't show a tab for windows with only one tab, as the infopane serves the purpose better
Sean Egan <seanegan@gmail.com>
parents: 18218
diff changeset
168 static gboolean infopane_press_cb(GtkWidget *widget, GdkEventButton *e, PidginConversation *conv);
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
169 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
170
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
171 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
172 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
173 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
174
22613
aff371178b6f Some leak fixes for the gtkrc-ed nicks in conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22612
diff changeset
175 static const GdkColor *get_nick_color(PidginConversation *gtkconv, const char *name) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
176 static GdkColor col;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
177 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
178 float scale;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
179
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180 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
181 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
182 (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
183
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184 /* 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
185 if (scale > 1) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186 col.red *= scale;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187 col.green *= scale;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188 col.blue *= scale;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
189 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
190
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191 return &col;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
192 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
193
19980
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
194 static PurpleBlistNode *
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
195 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
196 {
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
197 PurpleBlistNode *node = NULL;
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
198
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
199 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
200 case PURPLE_CONV_TYPE_IM:
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
201 node = (PurpleBlistNode*)purple_find_buddy(conv->account, conv->name);
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
202 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
203 break;
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_CHAT:
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
205 node = (PurpleBlistNode*)purple_blist_find_chat(conv->account, conv->name);
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
206 break;
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
207 default:
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
208 break;
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
209 }
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
210 return node;
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
211 }
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
212
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214 * Callbacks
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216
18797
0622a7f08dde smaller close buttons on tabs. I think this looks really good.
Sean Egan <seanegan@gmail.com>
parents: 18796
diff changeset
217 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
218 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
219 {
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
220 PidginConversation *gtkconv = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
221 GList *list = g_list_copy(gtkconv->convs);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
222 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
223 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
224 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
225 }
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
226
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
227 static gboolean
20077
fee0eea83e58 Honour the persistency when closing the window from the WM.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20051
diff changeset
228 close_conv_cb(GtkWidget *w, GdkEventButton *dontuse, PidginConversation *gtkconv)
19900
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
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 /* 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
231 * 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
232 * (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
233 * 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
234 * 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
235 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
236 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
237 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
238
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 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
240 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
241 {
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
242 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
243 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
244 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
245 hide_conv(gtkconv, TRUE);
21671
12b165b013e4 Fix a crash.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21665
diff changeset
246 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
247 }
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
248 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
249 {
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
250 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
251 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
252 !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
253 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
254 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
255 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
256 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
257 }
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
258 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
259 ;
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 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
261
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
262 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
263 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
264
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
265 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266 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
267 {
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
268 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
269
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
271 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
272
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
273 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
274 default_formatize(PidginConversation *c)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
275 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
276 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
277 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
278 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
279
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
280 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
281 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
282 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
283 default_formatize(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
284 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
285
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
286 static const char *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
287 pidgin_get_cmd_prefix(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
288 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
289 return "/";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
290 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
291
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
292 static PurpleCmdRet
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
293 say_command_cb(PurpleConversation *conv,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
294 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
295 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
296 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
297 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
298 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
299 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
300
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
301 return PURPLE_CMD_RET_OK;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
302 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
303
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
304 static PurpleCmdRet
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
305 me_command_cb(PurpleConversation *conv,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
306 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
307 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
308 char *tmp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
309
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
310 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
311
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
312 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
313 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
314 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
315 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
316
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
317 g_free(tmp);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
318 return PURPLE_CMD_RET_OK;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
319 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
320
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
321 static PurpleCmdRet
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
322 debug_command_cb(PurpleConversation *conv,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
323 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
324 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
325 char *tmp, *markup;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
326 PurpleCmdStatus status;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
327
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
328 if (!g_ascii_strcasecmp(args[0], "version")) {
21030
3cc856ca2338 Add a --with-extraversion option to ./configure so packagers can fine tune
Stu Tomlinson <stu@nosnilmot.com>
parents: 21008
diff changeset
329 tmp = g_strdup_printf("me is using %s v%s.", "Pidgin", DISPLAY_VERSION);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
330 markup = g_markup_escape_text(tmp, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
331
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
332 status = purple_cmd_do_command(conv, tmp, markup, error);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
333
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
334 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
335 g_free(markup);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
336 return status;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
337 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
338 purple_conversation_write(conv, NULL, _("Supported debug options are: version"),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
339 PURPLE_MESSAGE_NO_LOG|PURPLE_MESSAGE_ERROR, time(NULL));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
340 return PURPLE_CMD_STATUS_OK;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
341 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
342 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
343
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
344 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
345 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
346 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
347 GList *iter;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
348
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
349 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
350
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
351 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
352 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
353 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
354 }
65cd831b39cd Patch from jeff to add a 'clearall' command to clear all the scrollbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18263
diff changeset
355
65cd831b39cd Patch from jeff to add a 'clearall' command to clear all the scrollbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18263
diff changeset
356 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
357 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
358 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
359 {
65cd831b39cd Patch from jeff to add a 'clearall' command to clear all the scrollbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18263
diff changeset
360 clear_conversation_scrollback(conv);
65cd831b39cd Patch from jeff to add a 'clearall' command to clear all the scrollbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18263
diff changeset
361 return PURPLE_CMD_STATUS_OK;
65cd831b39cd Patch from jeff to add a 'clearall' command to clear all the scrollbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18263
diff changeset
362 }
65cd831b39cd Patch from jeff to add a 'clearall' command to clear all the scrollbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18263
diff changeset
363
65cd831b39cd Patch from jeff to add a 'clearall' command to clear all the scrollbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18263
diff changeset
364 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
365 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
366 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
367 {
65cd831b39cd Patch from jeff to add a 'clearall' command to clear all the scrollbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18263
diff changeset
368 purple_conversation_foreach(clear_conversation_scrollback);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
369 return PURPLE_CMD_STATUS_OK;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
370 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
371
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
372 static PurpleCmdRet
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
373 help_command_cb(PurpleConversation *conv,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
374 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
375 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
376 GList *l, *text;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
377 GString *s;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
378
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
379 if (args[0] != NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
380 s = g_string_new("");
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
381 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
382
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
383 if (text) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
384 for (l = text; l; l = l->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
385 if (l->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
386 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
387 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
388 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
389 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
390 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
391 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
392 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
393 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
394 "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
395
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
396 text = purple_cmd_list(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
397 for (l = text; l; l = l->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
398 if (l->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
399 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
400 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
401 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
402 g_list_free(text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
403 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
404
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
405 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
406 g_string_free(s, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
407
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
408 return PURPLE_CMD_STATUS_OK;
15374
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
411 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
412 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
413 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
414 GList *first;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
415
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
416 first = g_list_first(gtkconv->send_history);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
417 g_free(first->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
418 first->data = g_strdup(message);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
419 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
420 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
421
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
422 static gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
423 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
424 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
425 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
426 char *cmd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
427 const char *prefix;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
428 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
429 gboolean retval = FALSE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
430
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
431 gtkconv = PIDGIN_CONVERSATION(conv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
432 prefix = pidgin_get_cmd_prefix();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
433
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
434 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
435 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
436
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
437 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
438 && !gtk_text_iter_get_child_anchor(&start)) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
439 PurpleCmdStatus status;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
440 char *error, *cmdline, *markup, *send_history;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
441 GtkTextIter end;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
442
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
443 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
444 send_history_add(gtkconv, send_history);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
445 g_free(send_history);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
446
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
447 cmdline = cmd + strlen(prefix);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
448
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
449 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
450 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
451 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
452 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
453 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
454 }
52d7368fdc1c I'm gonna try adding in an easter egg here, see what people thing.
Mark Doliner <mark@kingant.net>
parents: 22038
diff changeset
455
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
456 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
457 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
458 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
459 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
460 g_free(markup);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
461
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
462 switch (status) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
463 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
464 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
465 break;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
466 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
467 {
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
468 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
469 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
470
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
471 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
472 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
473
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
474 if ((prpl_info != NULL) && (prpl_info->options & OPT_PROTO_SLASH_COMMANDS_NATIVE)) {
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
475 char *firstspace;
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
476 char *slash;
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
477
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
478 firstspace = strchr(cmdline, ' ');
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
479 if (firstspace != NULL) {
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
480 slash = strrchr(firstspace, '/');
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
481 } else {
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
482 slash = strchr(cmdline, '/');
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
483 }
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
484
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
485 if (slash == NULL) {
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
486 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
487 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
488 }
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
489 }
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
490 break;
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
491 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
492 case PURPLE_CMD_STATUS_WRONG_ARGS:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
493 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
494 "to that command."),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
495 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
496 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
497 break;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
498 case PURPLE_CMD_STATUS_FAILED:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
499 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
500 PURPLE_MESSAGE_NO_LOG, time(NULL));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
501 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
502 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
503 break;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
504 case PURPLE_CMD_STATUS_WRONG_TYPE:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
505 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
506 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
507 PURPLE_MESSAGE_NO_LOG, time(NULL));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
508 else
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
509 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
510 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
511 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
512 break;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
513 case PURPLE_CMD_STATUS_WRONG_PRPL:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
514 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
515 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
516 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
517 break;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
518 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
519 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
520
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
521 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
522 return retval;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
523 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
524
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
525 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
526 send_cb(GtkWidget *widget, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
527 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
528 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
529 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
530 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
531 PurpleMessageFlags flags = 0;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
532 char *buf, *clean;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
533
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
534 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
535
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
536 if (check_for_and_do_command(conv)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
537 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
538 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
539 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
540
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
541 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
542 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
543 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
544
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
545 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
546 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
547
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
548 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
549 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
550
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
551 gtk_widget_grab_focus(gtkconv->entry);
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 if (strlen(clean) == 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
554 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
555 g_free(clean);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
556 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
557 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
558
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
559 purple_idle_touch();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
560
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
561 /* 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
562 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
563 flags |= PURPLE_MESSAGE_IMAGES;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
564
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
565 gc = purple_account_get_connection(account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
566 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
567 char **bufs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
568 int i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
569
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
570 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
571 for (i = 0; bufs[i]; i++) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
572 send_history_add(gtkconv, bufs[i]);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
573 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
574 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
575 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
576 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
577 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
578
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
579 g_strfreev(bufs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
580
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
581 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
582 send_history_add(gtkconv, buf);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
583 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
584 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
585 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
586 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
587 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
588
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
589 g_free(clean);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
590 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
591
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
592 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry));
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
593 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
594 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
595
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
596 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
597 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
598 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
599 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
600 const char *name;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
601 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
602
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
603 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
604 name = purple_conversation_get_name(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
605
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
606 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
607 PurpleBuddy *b;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
608
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
609 b = purple_find_buddy(account, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
610 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
611 pidgin_dialogs_remove_buddy(b);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
612 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
613 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
614 } 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
615 PurpleChat *c;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
616
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
617 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
618 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
619 pidgin_dialogs_remove_chat(c);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
620 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
621 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
622 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
623
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
624 gtk_widget_grab_focus(PIDGIN_CONVERSATION(conv)->entry);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
625 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
626
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
627 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
628 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
629 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
630 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
631
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
632 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
633 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
634 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
635 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
636
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
637
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
638 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
639 info_cb(GtkWidget *widget, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
640 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
641 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
642
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
643 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
644 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
645 purple_conversation_get_name(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
646 gtk_widget_grab_focus(gtkconv->entry);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
647 } 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
648 /* 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
649 PidginChatPane *gtkchat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
650 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
651 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
652 GtkTreeSelection *sel;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
653 char *name;
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 gtkchat = gtkconv->u.chat;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
656
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
657 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
658 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
659
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
660 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
661 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
662 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
663 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
664
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
665 chat_do_info(gtkconv, name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
666 g_free(name);
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 block_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 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
675
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
676 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
677
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
678 if (account != NULL && purple_account_is_connected(account))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
679 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
680
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
681 gtk_widget_grab_focus(PIDGIN_CONVERSATION(conv)->entry);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
682 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
683
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
684 static void
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
685 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
686 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
687 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
688 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
689
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
690 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
691
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
692 if (account != NULL && purple_account_is_connected(account))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
693 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
694
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
695 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
696 }
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
697
22843
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
698 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
699 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
700 {
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
701 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
702 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
703
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
704 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
705 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
706 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
707 else
396fd93907f1 Add only the online buddies for auto-completion in the invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22843
diff changeset
708 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
709 } else {
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
710 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
711 }
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
712 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
713 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
714 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
715 }
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
716
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
717 static void
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
718 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
719 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
720 const char *buddy, *message;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
721 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
722
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
723 gtkconv = PIDGIN_CONVERSATION(info->conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
724
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
725 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
726 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
727 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
728
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
729 if (!g_ascii_strcasecmp(buddy, ""))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
730 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
731
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
732 serv_chat_invite(purple_conversation_get_gc(info->conv),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
733 purple_conv_chat_get_id(PURPLE_CONV_CHAT(info->conv)),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
734 message, buddy);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
735 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
736
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
737 gtk_widget_destroy(invite_dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
738 invite_dialog = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
739
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
740 g_free(info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
741 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
742
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
743 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
744 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
745 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
746 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
747 InviteBuddyInfo *info = (InviteBuddyInfo *)data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
748 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
749 gboolean success = TRUE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
750
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
751 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
752
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
753 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
754 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
755 PurpleBlistNode *node = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
756 PurpleBuddy *buddy;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
757
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
758 memcpy(&node, sd->data, sizeof(node));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
759
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
760 if (PURPLE_BLIST_NODE_IS_CONTACT(node))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
761 buddy = purple_contact_get_priority_buddy((PurpleContact *)node);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
762 else if (PURPLE_BLIST_NODE_IS_BUDDY(node))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
763 buddy = (PurpleBuddy *)node;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
764 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
765 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
766
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
767 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
768 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
769 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
770 _("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
771 "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
772 success = FALSE;
15374
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 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
775 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
776
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
777 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
778 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
779 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
780 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
781 char *protocol = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
782 char *username = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
783 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
784
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
785 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
786 &protocol, &username, NULL))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
787 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
788 if (account == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
789 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
790 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
791 _("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
792 "can invite that buddy."), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
793 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
794 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
795 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
796 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
797 _("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
798 "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
799 success = FALSE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
800 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
801 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
802 {
22843
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
803 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
804 }
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
807 g_free(username);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
808 g_free(protocol);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
809
22843
eb1321b2e496 Modified patch from John Moody to show aliases in the Invite dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22835
diff changeset
810 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
811 }
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
814 static const GtkTargetEntry dnd_targets[] =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
815 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
816 {"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
817 {"application/x-im-contact", 0, 1}
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
818 };
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 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
821 invite_cb(GtkWidget *widget, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
822 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
823 PurpleConversation *conv = gtkconv->active_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
824 InviteBuddyInfo *info = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
825
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
826 if (invite_dialog == NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
827 PurpleConnection *gc;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
828 PidginWindow *gtkwin;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
829 GtkWidget *label;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
830 GtkWidget *vbox, *hbox;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
831 GtkWidget *table;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
832 GtkWidget *img;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
833
15436
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15435
diff changeset
834 img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_QUESTION,
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15435
diff changeset
835 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
836
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
837 info = g_new0(InviteBuddyInfo, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
838 info->conv = conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
839
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
840 gc = purple_conversation_get_gc(conv);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
841 gtkwin = pidgin_conv_get_window(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
842
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
843 /* Create the new dialog. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
844 invite_dialog = gtk_dialog_new_with_buttons(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
845 _("Invite Buddy Into Chat Room"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
846 GTK_WINDOW(gtkwin->window), 0,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
847 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
15509
23ca11f8a8c4 stock to pidgin
Sean Egan <seanegan@gmail.com>
parents: 15508
diff changeset
848 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
849
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
850 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
851 GTK_RESPONSE_OK);
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
852 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
853 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
854 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
855
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
856 info->window = GTK_WIDGET(invite_dialog);
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 /* Setup the outside spacing. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
859 vbox = GTK_DIALOG(invite_dialog)->vbox;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
860
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
861 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
862 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
863
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
864 /* 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
865 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
866 gtk_container_add(GTK_CONTAINER(vbox), hbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
867 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
868 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
869
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
870 /* Setup the right vbox. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
871 vbox = gtk_vbox_new(FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
872 gtk_container_add(GTK_CONTAINER(hbox), vbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
873
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
874 /* Put our happy label in it. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
875 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
876 "to invite, along with an optional invite "
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
877 "message."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
878 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
879 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
880 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
881 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
882
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
883 /* 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
884 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
885 gtk_container_add(GTK_CONTAINER(vbox), hbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
886
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
887 /* 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
888 table = gtk_table_new(2, 2, FALSE);
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
889 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
890 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
891 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
892 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
893
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
894 /* Now the Buddy label */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
895 label = gtk_label_new(NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
896 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
897 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
898 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
899
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
900 /* 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
901 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
902 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
903 purple_conversation_get_account(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
904 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
905 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
906
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
907 /* Now the label for "Message" */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
908 label = gtk_label_new(NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
909 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
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_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
912
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
913
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
914 /* And finally, the Message entry field. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
915 info->message = gtk_entry_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
916 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
917
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
918 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
919 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
920
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
921 /* Connect the signals. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
922 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
923 G_CALLBACK(do_invite), info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
924 /* Setup drag-and-drop */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
925 gtk_drag_dest_set(info->window,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
926 GTK_DEST_DEFAULT_MOTION |
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
927 GTK_DEST_DEFAULT_DROP,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
928 dnd_targets,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
929 sizeof(dnd_targets) / sizeof(GtkTargetEntry),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
930 GDK_ACTION_COPY);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
931 gtk_drag_dest_set(info->entry,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
932 GTK_DEST_DEFAULT_MOTION |
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
933 GTK_DEST_DEFAULT_DROP,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
934 dnd_targets,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
935 sizeof(dnd_targets) / sizeof(GtkTargetEntry),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
936 GDK_ACTION_COPY);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
937
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
938 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
939 G_CALLBACK(invite_dnd_recv), info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
940 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
941 G_CALLBACK(invite_dnd_recv), info);
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 gtk_widget_show_all(invite_dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
945
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
946 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
947 gtk_widget_grab_focus(info->entry);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
948 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
949
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
950 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
951 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
952 {
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
953 pidgin_dialogs_im();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
954 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
955
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
956 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
957 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
958 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
959 PurpleConversation *conv = (PurpleConversation *)user_data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
960 FILE *fp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
961 const char *name;
19665
37429bc82307 I think this fixes #2858.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19655
diff changeset
962 char **lines;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
963 gchar *text;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
964
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
965 if ((fp = g_fopen(filename, "w+")) == NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
966 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
967 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
968 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
969
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
970 name = purple_conversation_get_name(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
971 fprintf(fp, "<html>\n<head><title>%s</title></head>\n<body>", name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
972 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
973
19665
37429bc82307 I think this fixes #2858.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19655
diff changeset
974 lines = gtk_imhtml_get_markup_lines(
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
975 GTK_IMHTML(PIDGIN_CONVERSATION(conv)->imhtml));
19667
a2f5a28ba983 More fix, thanks to SimGuy.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19665
diff changeset
976 text = g_strjoinv("<br>\n", lines);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
977 fprintf(fp, "%s", text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
978 g_free(text);
19665
37429bc82307 I think this fixes #2858.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19655
diff changeset
979 g_strfreev(lines);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
980
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
981 fprintf(fp, "\n</body>\n</html>\n");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
982 fclose(fp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
983 }
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 * 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
987 * plaintext v. HTML file.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
988 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
989 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
990 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
991 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
992 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
993 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
994 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
995 const char *name;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
996 gchar *buf;
17195
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
997 gchar *c;
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
998
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
999 if (buddy != NULL)
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1000 name = purple_buddy_get_contact_alias(buddy);
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1001 else
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1002 name = purple_normalize(conv->account, conv->name);
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1003
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1004 buf = g_strdup_printf("%s.html", name);
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1005 for (c = buf ; *c ; c++)
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1006 {
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1007 if (*c == '/' || *c == '\\')
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1008 *c = ' ';
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
1009 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1010 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
1011 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
1012 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
1013 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
1014 conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1015
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1016 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1017 }
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 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1020 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
1021 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1022 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1023 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1024 PurpleLogType type;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1025 PidginBuddyList *gtkblist;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1026 GdkCursor *cursor;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1027 const char *name;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1028 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1029 GSList *buddies;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1030 GSList *cur;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1031
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1032 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
1033
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1034 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
1035 type = PURPLE_LOG_IM;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1036 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
1037 type = PURPLE_LOG_CHAT;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1038 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1039 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1040
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1041 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
1042
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1043 cursor = gdk_cursor_new(GDK_WATCH);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1044 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
1045 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
1046 gdk_cursor_unref(cursor);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1047 #if GTK_CHECK_VERSION(2,4,0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1048 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
1049 #else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1050 gdk_flush();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1051 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1052
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1053 name = purple_conversation_get_name(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1054 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1055
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1056 buddies = purple_find_buddies(account, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1057 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
1058 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1059 PurpleBlistNode *node = cur->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1060 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
1061 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1062 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
1063 g_slist_free(buddies);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1064 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
1065 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
1066 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1067 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1068 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1069 g_slist_free(buddies);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1070
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1071 pidgin_log_show(type, name, account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1072
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1073 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
1074 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
1075 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1076
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1077 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1078 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
1079 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1080 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1081 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1082
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1083 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
1084 clear_conversation_scrollback(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1085 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1086
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1087 struct _search {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1088 PidginWindow *gtkwin;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1089 GtkWidget *entry;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1090 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1091
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1092 static void do_search_cb(GtkWidget *widget, gint resp, struct _search *s)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1093 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1094 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1095 PidginConversation *gtk_active_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1096 GList *iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1097
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1098 conv = pidgin_conv_window_get_active_conversation(s->gtkwin);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1099 gtk_active_conv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1100
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1101 switch (resp)
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 case GTK_RESPONSE_OK:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1104 /* clear highlighting except the active conversation window
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1105 * highlight the keywords in the active conversation window */
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1106 for (iter = pidgin_conv_window_get_gtkconvs(s->gtkwin) ; iter ; iter = iter->next)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1107 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1108 PidginConversation *gtkconv = iter->data;
15374
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 if (gtkconv != gtk_active_conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1111 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1112 gtk_imhtml_search_clear(GTK_IMHTML(gtkconv->imhtml));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1113 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1114 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1115 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1116 gtk_imhtml_search_find(GTK_IMHTML(gtk_active_conv->imhtml),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1117 gtk_entry_get_text(GTK_ENTRY(s->entry)));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1118 }
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 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1121
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1122 case GTK_RESPONSE_DELETE_EVENT:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1123 case GTK_RESPONSE_CLOSE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1124 /* clear the keyword highlighting in all the conversation windows */
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1125 for (iter = pidgin_conv_window_get_gtkconvs(s->gtkwin); iter; iter=iter->next)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1126 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1127 PidginConversation *gconv = iter->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1128 gtk_imhtml_search_clear(GTK_IMHTML(gconv->imhtml));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1129 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1130
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1131 gtk_widget_destroy(s->gtkwin->dialogs.search);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1132 s->gtkwin->dialogs.search = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1133 g_free(s);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1134 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1135 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1136 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1137
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1138 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1139 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
1140 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1141 PidginWindow *gtkwin = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1142 GtkWidget *hbox;
15436
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15435
diff changeset
1143 GtkWidget *img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_QUESTION,
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15435
diff changeset
1144 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
1145 GtkWidget *label;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1146 struct _search *s;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1147
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1148 if (gtkwin->dialogs.search) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1149 gtk_window_present(GTK_WINDOW(gtkwin->dialogs.search));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1150 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1151 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1152
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1153 s = g_malloc(sizeof(struct _search));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1154 s->gtkwin = gtkwin;
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 gtkwin->dialogs.search = gtk_dialog_new_with_buttons(_("Find"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1157 GTK_WINDOW(gtkwin->window), GTK_DIALOG_DESTROY_WITH_PARENT,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1158 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1159 GTK_STOCK_FIND, GTK_RESPONSE_OK, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1160 gtk_dialog_set_default_response(GTK_DIALOG(gtkwin->dialogs.search),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1161 GTK_RESPONSE_OK);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1162 g_signal_connect(G_OBJECT(gtkwin->dialogs.search), "response",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1163 G_CALLBACK(do_search_cb), s);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1164
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
1165 gtk_container_set_border_width(GTK_CONTAINER(gtkwin->dialogs.search), PIDGIN_HIG_BOX_SPACE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1166 gtk_window_set_resizable(GTK_WINDOW(gtkwin->dialogs.search), FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1167 gtk_dialog_set_has_separator(GTK_DIALOG(gtkwin->dialogs.search), FALSE);
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
1168 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(gtkwin->dialogs.search)->vbox), PIDGIN_HIG_BORDER);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1169 gtk_container_set_border_width(
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
1170 GTK_CONTAINER(GTK_DIALOG(gtkwin->dialogs.search)->vbox), PIDGIN_HIG_BOX_SPACE);
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
1171
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
1172 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
1173 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(gtkwin->dialogs.search)->vbox),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1174 hbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1175 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
1176
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1177 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
1178 gtk_dialog_set_response_sensitive(GTK_DIALOG(gtkwin->dialogs.search),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1179 GTK_RESPONSE_OK, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1180
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1181 label = gtk_label_new(NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1182 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Search for:"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1183 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
1184
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1185 s->entry = gtk_entry_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1186 gtk_entry_set_activates_default(GTK_ENTRY(s->entry), TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1187 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(s->entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1188 g_signal_connect(G_OBJECT(s->entry), "changed",
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1189 G_CALLBACK(pidgin_set_sensitive_if_input),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1190 gtkwin->dialogs.search);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1191 gtk_box_pack_start(GTK_BOX(hbox), s->entry, FALSE, FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1192
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1193 gtk_widget_show_all(gtkwin->dialogs.search);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1194 gtk_widget_grab_focus(s->entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1195 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1196
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1197 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1198 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
1199 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1200 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1201 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
1202
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1203 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
1204 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
1205 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1206
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1207 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1208
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1209 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1210 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
1211 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1212 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1213 PurpleConversation *conv;
15374
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 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
1216
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1217 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
1218 purple_conversation_get_name(conv), NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1219 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1220
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1221 static void
17776
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1222 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
1223 {
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1224 PidginWindow *win = data;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1225 PidginConversation *gtkconv;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1226 GtkIMHtmlToolbar *toolbar;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1227
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1228 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
1229 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar);
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1230
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1231 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
1232 !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
1233 }
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1234
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1235 static void
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1236 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
1237 {
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1238 PidginWindow *win = data;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1239 PurpleConversation *conv;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1240 PidginConversation *gtkconv;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1241 GtkIMHtmlToolbar *toolbar;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1242
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1243 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
1244 conv = gtkconv->active_conv;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1245 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar);
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1246
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1247 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
1248 !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
1249 }
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1250
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1251
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1252 static void
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1253 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
1254 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1255 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1256 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1257 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1258 const char *name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1259
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1260 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
1261 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1262 name = purple_conversation_get_name(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1263
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1264 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
1265 PurpleBuddy *b;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1266
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1267 b = purple_find_buddy(account, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1268 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
1269 pidgin_dialogs_alias_buddy(b);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1270 } 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
1271 PurpleChat *c;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1272
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1273 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
1274 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
1275 pidgin_dialogs_alias_chat(c);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1276 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1277 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1278
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1279 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1280 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
1281 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1282 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1283 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1284
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1285 conv = pidgin_conv_window_get_active_conversation(win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1286
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1287 info_cb(NULL, PIDGIN_CONVERSATION(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1288 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1289
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1290 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1291 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
1292 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1293 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1294 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1295
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1296 conv = pidgin_conv_window_get_active_conversation(win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1297
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1298 invite_cb(NULL, PIDGIN_CONVERSATION(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1299 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1300
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1301 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1302 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
1303 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1304 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1305 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1306
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1307 conv = pidgin_conv_window_get_active_conversation(win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1308
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1309 block_cb(NULL, PIDGIN_CONVERSATION(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1310 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1311
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1312 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
1313 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
1314 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1315 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1316 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
1317
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1318 conv = pidgin_conv_window_get_active_conversation(win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1319
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1320 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
1321 }
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
1322
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
1323 static void
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1324 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
1325 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1326 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1327 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1328
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1329 conv = pidgin_conv_window_get_active_conversation(win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1330
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1331 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
1332 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1333
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
1334 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
1335 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
1336 {
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1337 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
1338 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
1339 }
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1340
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1341 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
1342 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
1343 {
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1344 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
1345
19556
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
1346 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
1347 "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
1348
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1349 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
1350 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
1351 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
1352 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
1353 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
1354 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
1355 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
1356 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
1357 }
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
1358 #if 0
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
1359 /* 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
1360 purple_conversation_set_ui_ops(conv, NULL);
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
1361 #else
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
1362 pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv);
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
1363 pidgin_conv_window_add_gtkconv(hidden_convwin, gtkconv);
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
1364 #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
1365 }
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
1366 }
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
1367
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
1368 static void
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1369 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
1370 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1371 PidginWindow *win = data;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1372
18797
0622a7f08dde smaller close buttons on tabs. I think this looks really good.
Sean Egan <seanegan@gmail.com>
parents: 18796
diff changeset
1373 close_conv_cb(NULL, NULL, PIDGIN_CONVERSATION(pidgin_conv_window_get_active_conversation(win)));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1374 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1375
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1376 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1377 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
1378 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1379 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1380 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1381 gboolean logging;
22009
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1382 PurpleBlistNode *node;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1383
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1384 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
1385
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1386 if (conv == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1387 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1388
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1389 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
1390
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1391 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
1392 return;
22009
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1393
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1394 node = get_conversation_blist_node(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1395
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1396 if (logging)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1397 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1398 /* 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
1399 purple_conversation_set_logging(conv, TRUE);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1400
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1401 purple_conversation_write(conv, NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1402 _("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
1403 conv->logs ? (PURPLE_MESSAGE_SYSTEM) :
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1404 (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
1405 time(NULL));
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 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1408 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1409 purple_conversation_write(conv, NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1410 _("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
1411 conv->logs ? (PURPLE_MESSAGE_SYSTEM) :
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1412 (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
1413 time(NULL));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1414
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1415 /* 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
1416 purple_conversation_set_logging(conv, FALSE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1417 }
22009
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1418
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1419 /* 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
1420 switch (conv->type)
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1421 {
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1422 case PURPLE_CONV_TYPE_IM:
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1423 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
1424 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
1425 else
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1426 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
1427 break;
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1428
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1429 case PURPLE_CONV_TYPE_CHAT:
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1430 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
1431 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
1432 else
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1433 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
1434 break;
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1435
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1436 default:
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1437 break;
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1438 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1439 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1440
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1441 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1442 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
1443 {
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
1444 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
1445 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
1446 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1447
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1448 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1449 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
1450 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1451 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1452 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1453 PidginConversation *gtkconv;
19980
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
1454 PurpleBlistNode *node;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1455
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1456 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
1457
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1458 if (!conv)
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
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1461 gtkconv = PIDGIN_CONVERSATION(conv);
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 gtkconv->make_sound =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1464 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
1465 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
1466 if (node)
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
1467 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
1468 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1469
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1470 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1471 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
1472 {
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
1473 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
1474 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
1475 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1476
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1477 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1478 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
1479 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1480 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1481 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1482 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1483 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
1484 gchar *real_who = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1485
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1486 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1487 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1488
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1489 gc = purple_account_get_connection(account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1490 g_return_if_fail(gc != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1491
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1492 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
1493
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1494 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
1495 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
1496 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
1497
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
1498 if(!who && !real_who)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1499 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1500
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
1501 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
1502
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1503 g_free(real_who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1504 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1505
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
1506 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
1507
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1508 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1509 ignore_cb(GtkWidget *w, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1510 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1511 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1512 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
1513 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
1514
3974d12a56ec Fix ignore in chats when using right-click on a nick in the conversation
Stu Tomlinson <stu@nosnilmot.com>
parents: 16273
diff changeset
1515 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
1516 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
1517
3974d12a56ec Fix ignore in chats when using right-click on a nick in the conversation
Stu Tomlinson <stu@nosnilmot.com>
parents: 16273
diff changeset
1518 if (name == NULL)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1519 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1520
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1521 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
1522 purple_conv_chat_unignore(chat, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1523 else
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1524 purple_conv_chat_ignore(chat, name);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1525
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
1526 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
1527 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1528
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1529 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1530 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
1531 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1532 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
1533
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1534 chat_do_im(gtkconv, who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1535 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1536
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1537 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1538 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
1539 {
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
1540 PurplePluginProtocolInfo *prpl_info;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1541 PurpleConversation *conv = gtkconv->active_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1542 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
1543 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
1544 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
1545
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
1546 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
1547
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
1548 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
1549
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
1550 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
1551 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
1552 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
1553
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
1554 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
1555 g_free(real_who);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1556 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1557
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1558 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1559 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
1560 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1561 char *who;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1562
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1563 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
1564
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1565 chat_do_info(gtkconv, who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1566 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1567
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1568 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1569 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
1570 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1571 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1572 PurplePluginProtocolInfo *prpl_info = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1573 PurpleConnection *gc;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1574 char *who;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1575
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1576 gc = purple_conversation_get_gc(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1577 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
1578
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1579 if (gc != NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1580 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
1581
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1582 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1583 * 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
1584 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1585
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1586 if (prpl_info->get_cb_away != NULL)
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 prpl_info->get_cb_away(gc,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1589 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
1590 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1591 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1592 }
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 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1595 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
1596 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1597 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1598 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1599 PurpleBuddy *b;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1600 char *name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1601
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1602 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1603 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
1604 b = purple_find_buddy(account, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1605
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1606 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
1607 pidgin_dialogs_remove_buddy(b);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1608 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
1609 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
1610
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1611 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
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 static GtkTextMark *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1615 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
1616 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1617 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
1618 char *tmp = g_strconcat("user:", who, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1619 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
1620
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1621 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1622 return mark;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1623 }
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 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1626 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
1627 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1628 GtkTextMark *mark;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1629 const char *who;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1630
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1631 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
1632 mark = get_mark_for_user(gtkconv, who);
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 if (mark != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1635 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
1636 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1637 g_return_if_reached();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1638 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1639
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1640 static GtkWidget *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1641 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
1642 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1643 static GtkWidget *menu = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1644 PurplePluginProtocolInfo *prpl_info = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1645 PurpleConvChat *chat = PURPLE_CONV_CHAT(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1646 gboolean is_me = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1647 GtkWidget *button;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1648 PurpleBuddy *buddy = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1649
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1650 if (gc != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1651 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
1652
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1653 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1654 * 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
1655 * thus freeing-up the memory it occupied.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1656 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1657 if (menu)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1658 gtk_widget_destroy(menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1659
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1660 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
1661 is_me = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1662
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1663 menu = gtk_menu_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1664
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1665 if (!is_me) {
15560
442128853bdb toolbar/menu icons. reduce the imhtmltoolbar spacing. more gaimstock pruning
Sean Egan <seanegan@gmail.com>
parents: 15557
diff changeset
1666 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
1667 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
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->send_file)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1676 {
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
1677 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
1678
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
1679 button = pidgin_new_item_from_stock(menu, _("Send File"),
16839
d6ccf170148e New Send File icon
Hylke Bons <hylkebons@gmail.com>
parents: 16809
diff changeset
1680 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
1681 PIDGIN_CONVERSATION(conv), 0, 0, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1682
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
1683 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
1684 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
1685 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
1686 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
1687 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
1688 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
1689 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
1690 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
1691 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
1692 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
1693 }
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
1694
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
1695 if (!can_receive_file)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1696 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
1697 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
1698 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
1699 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1700
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1701
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1702 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
1703 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
1704 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
1705 else
15509
23ca11f8a8c4 stock to pidgin
Sean Egan <seanegan@gmail.com>
parents: 15508
diff changeset
1706 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
1707 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
1708
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1709 if (gc == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1710 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
1711 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
1712 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
1713 }
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 (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
1716 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
1717 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
1718
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1719 if (gc == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1720 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
1721 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
1722 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
1723 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1724
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1725 if (prpl_info && prpl_info->get_cb_away) {
15509
23ca11f8a8c4 stock to pidgin
Sean Egan <seanegan@gmail.com>
parents: 15508
diff changeset
1726 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
1727 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
1728
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1729 if (gc == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1730 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
1731 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
1732 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
1733 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1734
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1735 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
1736 if ((buddy = purple_find_buddy(conv->account, who)) != NULL)
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
1737 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
1738 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
1739 else
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
1740 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
1741 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
1742
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1743 if (gc == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1744 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
1745 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
1746 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
1747 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1748
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
1749 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
1750 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
1751 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
1752 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
1753 gtk_widget_set_sensitive(button, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1754
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1755 if (buddy != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1756 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1757 if (purple_account_is_connected(conv->account))
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1758 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
1759 (PurpleBlistNode *)buddy);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1760 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
1761 gtk_widget_show_all(menu);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1764 return menu;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1765 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1766
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1767
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1768 static gint
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1769 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
1770 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1771 PurpleConversation *conv = gtkconv->active_conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1772 PidginChatPane *gtkchat;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1773 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1774 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1775 GtkTreeSelection *sel;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1776 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1777 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1778 GtkWidget *menu;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1779 gchar *who;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1780
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1781 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1782 gtkchat = gtkconv->u.chat;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1783 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1784 gc = account->gc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1785
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1786 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
1787
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1788 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
1789 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
1790 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1791
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1792 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
1793 menu = create_chat_menu (conv, who, gc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1794 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
1795 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
1796 0, GDK_CURRENT_TIME);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1797 g_free(who);
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 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1800 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1801
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1802
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1803 static gint
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1804 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
1805 PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1806 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1807 PurpleConversation *conv = gtkconv->active_conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1808 PidginChatPane *gtkchat;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1809 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1810 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1811 GtkTreePath *path;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1812 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1813 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1814 GtkTreeViewColumn *column;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1815 gchar *who;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1816 int x, y;
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 gtkchat = gtkconv->u.chat;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1819 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1820 gc = account->gc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1821
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1822 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
1823
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1824 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
1825 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
1826
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1827 if (path == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1828 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1829
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1830 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
1831 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
1832 gtk_tree_view_set_cursor(GTK_TREE_VIEW(gtkchat->list),
6fa1bbf6b0a9 Allow the userlist to get focus, to allow keyboard navigation of it.
Sean Egan <seanegan@gmail.com>
parents: 18306
diff changeset
1833 path, NULL, FALSE);
6fa1bbf6b0a9 Allow the userlist to get focus, to allow keyboard navigation of it.
Sean Egan <seanegan@gmail.com>
parents: 18306
diff changeset
1834 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
1835
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1836 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
1837 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
1838
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1839 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
1840 chat_do_im(gtkconv, who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1841 } 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
1842 /* Move to user's anchor */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1843 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
1844
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1845 if(mark != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1846 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
1847 } 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
1848 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
1849 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
1850 event->button, event->time);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1851 }
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 g_free(who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1854 gtk_tree_path_free(path);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1855
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1856 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1857 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1858
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1859 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
1860 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
1861 {
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
1862 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
1863 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
1864 gchar *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
1865
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
1866 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
1867
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
1868 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
1869 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
1870 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
1871
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
1872 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
1873 }
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
1874
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
1875 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1876 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
1877 {
17141
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1878 PidginConversation *next_gtkconv = NULL, *most_active = NULL;
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1879 PidginUnseenState unseen_state = PIDGIN_UNSEEN_NONE;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1880 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1881 int initial, i, total, diff;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1882
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1883 win = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1884 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
1885 gtkconv->tab_cont);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1886 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
1887 /* 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
1888 * 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
1889 * positive number.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1890 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1891 diff = (forward ? 1 : -1) + total;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1892
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1893 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
1894 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
1895 if (next_gtkconv->unseen_state > unseen_state) {
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1896 most_active = next_gtkconv;
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1897 unseen_state = most_active->unseen_state;
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1898 if(PIDGIN_UNSEEN_NICK == unseen_state) /* highest possible state */
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1899 break;
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1900 }
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1901 }
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1902
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1903 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
1904 i = (i + diff) % total;
17141
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1905 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
1906 }
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1907
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1908 if (most_active != NULL && most_active != gtkconv)
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1909 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
1910 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1911
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1912 static gboolean
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1913 conv_keypress_common(PidginConversation *gtkconv, GdkEventKey *event)
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1914 {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1915 PidginWindow *win;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1916 PurpleConversation *conv;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1917 int curconv;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1918
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1919 conv = gtkconv->active_conv;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1920 win = gtkconv->win;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1921 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
1922
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1923 /* If CTRL was held down... */
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1924 if (event->state & GDK_CONTROL_MASK) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1925 switch (event->keyval) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1926 case GDK_Page_Down:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1927 case ']':
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1928 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
1929 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
1930 else
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1931 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
1932 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1933 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1934
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1935 case GDK_Page_Up:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1936 case '[':
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1937 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
1938 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
1939 else
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1940 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
1941 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1942 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1943
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1944 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
1945 case GDK_KP_Tab:
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1946 case GDK_ISO_Left_Tab:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1947 if (event->state & GDK_SHIFT_MASK) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1948 move_to_next_unread_tab(gtkconv, FALSE);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1949 } else {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1950 move_to_next_unread_tab(gtkconv, TRUE);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1951 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1952
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1953 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1954 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1955
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1956 case GDK_comma:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1957 gtk_notebook_reorder_child(GTK_NOTEBOOK(win->notebook),
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1958 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
1959 curconv - 1);
20190
da6a1320d3e1 applied changes from f4700a52b60d8473e9671ceabfec7772211fe424
Richard Laager <rlaager@wiktel.com>
parents: 20183
diff changeset
1960 return TRUE;
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1961 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1962
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1963 case GDK_period:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1964 gtk_notebook_reorder_child(GTK_NOTEBOOK(win->notebook),
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1965 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
1966 #if GTK_CHECK_VERSION(2,2,0)
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1967 (curconv + 1) % gtk_notebook_get_n_pages(GTK_NOTEBOOK(win->notebook)));
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1968 #else
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1969 (curconv + 1) % g_list_length(GTK_NOTEBOOK(win->notebook)->children));
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1970 #endif
20190
da6a1320d3e1 applied changes from f4700a52b60d8473e9671ceabfec7772211fe424
Richard Laager <rlaager@wiktel.com>
parents: 20183
diff changeset
1971 return TRUE;
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1972 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1973
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1974 } /* End of switch */
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
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1977 /* If ALT (or whatever) was held down... */
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1978 else if (event->state & GDK_MOD1_MASK)
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1979 {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1980 if (event->keyval > '0' && event->keyval <= '9')
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 guint switchto = event->keyval - '1';
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1983 if (switchto < pidgin_conv_window_get_gtkconv_count(win))
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1984 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
1985
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1986 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1987 }
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
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1990 /* If neither CTRL nor ALT were held down... */
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1991 else
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1992 {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1993 switch (event->keyval) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1994 case GDK_F2:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1995 if (gtk_widget_is_focus(GTK_WIDGET(win->notebook))) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1996 infopane_entry_activate(gtkconv);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1997 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1998 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1999 break;
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 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2008 PidginWindow *win;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2009 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2010 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2011
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2012 gtkconv = (PidginConversation *)data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2013 conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2014 win = gtkconv->win;
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2015
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2016 if (conv_keypress_common(gtkconv, event))
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2017 return TRUE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2018
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2019 /* If CTRL was held down... */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2020 if (event->state & GDK_CONTROL_MASK) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2021 switch (event->keyval) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2022 case GDK_Up:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2023 if (!gtkconv->send_history)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2024 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2025
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
2026 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
2027 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
2028
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2029 if (!gtkconv->send_history->prev) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2030 GtkTextIter start, end;
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 g_free(gtkconv->send_history->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2033
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2034 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
2035 &start);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2036 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
2037
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2038 gtkconv->send_history->data =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2039 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
2040 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2041
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2042 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
2043 GObject *object;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2044 GtkTextIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2045 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
2046
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2047 gtkconv->send_history = gtkconv->send_history->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2048
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2049 /* 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
2050 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
2051 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
2052 NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2053 /* Clear the formatting. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2054 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
2055 /* Unblock the signal. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2056 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
2057 NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2058 g_object_unref(object);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2059
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2060 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2061 gtk_imhtml_append_text_with_images(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2062 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
2063 0, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2064 /* 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
2065 * cursor gets picked up. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2066 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
2067 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
2068 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2069
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2070 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2071 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2072
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2073 case GDK_Down:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2074 if (!gtkconv->send_history)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2075 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2076
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
2077 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
2078 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
2079
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2080 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
2081 GObject *object;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2082 GtkTextIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2083 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
2084
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2085 gtkconv->send_history = gtkconv->send_history->prev;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2086
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2087 /* 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
2088 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
2089 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
2090 NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2091 /* Clear the formatting. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2092 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
2093 /* Unblock the signal. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2094 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
2095 NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2096 g_object_unref(object);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2097
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2098 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2099 gtk_imhtml_append_text_with_images(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2100 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
2101 0, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2102 /* 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
2103 * cursor gets picked up. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2104 if (*(char *)gtkconv->send_history->data) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2105 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
2106 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
2107 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2108 /* Restore the default formatting */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2109 default_formatize(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2110 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2111 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2112
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2113 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2114 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2115 } /* End of switch */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2116 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2117
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2118 /* If ALT (or whatever) was held down... */
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2119 else if (event->state & GDK_MOD1_MASK) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2120
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2121 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2122
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2123 /* If neither CTRL nor ALT were held down... */
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2124 else {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2125 switch (event->keyval) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2126 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
2127 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
2128 case GDK_ISO_Left_Tab:
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2129 if (gtkconv->entry != entry)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2130 break;
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2131 return tab_complete(conv);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2132 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2133
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2134 case GDK_Page_Up:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2135 gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml));
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2136 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2137 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2138
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2139 case GDK_Page_Down:
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) ||
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2195 (event->keyval == GDK_Page_Down) ||
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2196 (event->keyval == GDK_Home) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2197 (event->keyval == GDK_End) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2198 (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
2199 (event->keyval == GDK_KP_Tab) ||
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2200 (event->keyval == GDK_ISO_Left_Tab))
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2201 {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2202 if (event->type == GDK_KEY_PRESS)
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2203 return conv_keypress_common(gtkconv, event);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2204 return FALSE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2205 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2206
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2207 if (event->type == GDK_KEY_RELEASE)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2208 gtk_widget_grab_focus(gtkconv->entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2209
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2210 gtk_widget_event(gtkconv->entry, (GdkEvent *)event);
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 return TRUE;
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
17846
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
2215 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
2216 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
2217
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2218 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2219 pidgin_conv_switch_active_conversation(PurpleConversation *conv)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2220 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2221 PidginConversation *gtkconv;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2222 PurpleConversation *old_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2223 GtkIMHtml *entry;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2224 const char *protocol_name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2225
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2226 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2227
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2228 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2229 old_conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2230
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2231 if (old_conv == conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2232 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2233
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2234 purple_conversation_close_logs(old_conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2235 gtkconv->active_conv = conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2236
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2237 purple_conversation_set_logging(conv,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2238 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
2239
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2240 entry = GTK_IMHTML(gtkconv->entry);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2241 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
2242 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
2243 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
2244
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2245 if (!(conv->features & PURPLE_CONNECTION_HTML))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2246 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
2247 else if (conv->features & PURPLE_CONNECTION_FORMATTING_WBFO &&
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2248 !(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
2249 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2250 /* 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
2251 * 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
2252 * 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
2253 * 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
2254 * 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
2255
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2256 gboolean bold;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2257 gboolean italic;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2258 gboolean underline;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2259 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
2260 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
2261 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
2262 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
2263 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
2264 gboolean bold2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2265 gboolean italic2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2266 gboolean underline2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2267
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2268 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
2269
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2270 /* Clear existing formatting */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2271 gtk_imhtml_clear_formatting(entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2272
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2273 /* Apply saved formatting to the whole buffer. */
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, &bold2, &italic2, &underline2);
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 if (bold != bold2)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2278 gtk_imhtml_toggle_bold(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 if (italic != italic2)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2281 gtk_imhtml_toggle_italic(entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2282
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2283 if (underline != underline2)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2284 gtk_imhtml_toggle_underline(entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2285
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2286 gtk_imhtml_toggle_fontface(entry, fontface);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2287
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2288 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
2289 gtk_imhtml_font_set_size(entry, fontsize);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2290
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2291 gtk_imhtml_toggle_forecolor(entry, forecolor);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2292
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2293 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
2294 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2295 gtk_imhtml_toggle_backcolor(entry, backcolor);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2296 gtk_imhtml_toggle_background(entry, background);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2299 g_free(fontface);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2300 g_free(forecolor);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2301 g_free(backcolor);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2302 g_free(background);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2303 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2304 else
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 /* 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
2307 * 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
2308 * 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
2309 * 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
2310 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
2311 (conv->features & PURPLE_CONNECTION_FORMATTING_WBFO));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2312 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2313
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2314 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
2315
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2316 gray_stuff_out(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2317 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
2318 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
2319 regenerate_options_items(gtkconv->win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2320
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2321 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
2322 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
2323 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2324
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2325 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2326 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
2327 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2328 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
2329 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
2330 PurpleConversation *conv;
15374
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 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
2333 return;
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 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
2336 pidgin_conv_switch_active_conversation(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2337 }
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 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2340 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2341 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
2342 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2343 PidginConversation *gtkconv = (PidginConversation *)user_data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2344 PurpleConversation *conv;
15374
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 g_return_if_fail(gtkconv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2347
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2348 conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2349
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
2350 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
2351 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2352
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2353 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
2354 gtk_text_iter_is_end(position)));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2355 }
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 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2358 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
2359 GtkTextIter *end_pos, gpointer user_data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2360 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2361 PidginConversation *gtkconv = (PidginConversation *)user_data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2362 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2363 PurpleConvIm *im;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2364
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2365 g_return_if_fail(gtkconv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2366
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2367 conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2368
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
2369 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
2370 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2371
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2372 im = PURPLE_CONV_IM(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2374 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
2375
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2376 /* 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
2377 purple_conv_im_stop_send_typed_timeout(im);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2378
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2379 serv_send_typing(purple_conversation_get_gc(conv),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2380 purple_conversation_get_name(conv),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2381 PURPLE_NOT_TYPING);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2382 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2383 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2384 /* 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
2385 got_typing_keypress(gtkconv, FALSE);
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2388
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2389 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2390 * A bunch of buddy icon functions
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2391 **************************************************************************/
15724
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2392
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2393 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
2394 {
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2395 GList *l = NULL;
17397
012aaa301a30 Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17392
diff changeset
2396 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
2397 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
2398 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
2399 l = g_hash_table_lookup(prpl_lists, prplname);
15724
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2400 if (l)
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2401 return l;
17397
012aaa301a30 Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17392
diff changeset
2402
012aaa301a30 Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17392
diff changeset
2403 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
2404 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
2405 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
2406
012aaa301a30 Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17392
diff changeset
2407 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
2408 return l;
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2409 }
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2410
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2411 static GList *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2412 pidgin_conv_get_tab_icons(PurpleConversation *conv)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2413 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2414 PurpleAccount *account = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2415 const char *name = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2416
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2417 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
2418
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2419 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2420 name = purple_conversation_get_name(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2421
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2422 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
2423 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
2424
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2425 /* Use the buddy icon, if possible */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2426 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
2427 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
2428 if (b != NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2429 PurplePresence *p;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2430 p = purple_buddy_get_presence(b);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2431 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
2432 return away_list;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2433 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
2434 return busy_list;
15823
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_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
2436 return xa_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_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
2438 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
2439 else
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 available_list;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2441 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2442 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2443
15724
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2444 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
2445 }
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2446
19899
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2447 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
2448 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
2449 {
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2450 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
2451 const char *name = NULL;
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2452 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
2453 PurpleBlistUiOps *ops = purple_blist_get_ui_ops();
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2454 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
2455
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2456 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
2457 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
2458
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2459 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
2460 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
2461
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2462 /* 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
2463 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
2464 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
2465 if (b != NULL) {
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2466 PurplePresence *p = purple_buddy_get_presence(b);
19899
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2467 /* 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
2468 * 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
2469 * 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
2470 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
2471 ops->update(NULL, (PurpleBlistNode*)b);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2472
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2473 /* XXX Seanegan: We really need a util function to return a pixbuf for a Presence to avoid all this switching */
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2474 if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_AWAY))
19899
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2475 status = pidgin_create_status_icon(PURPLE_STATUS_AWAY, parent, icon_size);
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2476 else if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_EXTENDED_AWAY))
19899
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2477 status = pidgin_create_status_icon(PURPLE_STATUS_EXTENDED_AWAY, parent, icon_size);
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2478 else if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_OFFLINE))
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2479 status = pidgin_create_status_icon(PURPLE_STATUS_OFFLINE, parent, icon_size);
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2480 else if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_AVAILABLE))
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2481 status = pidgin_create_status_icon(PURPLE_STATUS_AVAILABLE, parent, icon_size);
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2482 else if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_INVISIBLE))
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2483 status = pidgin_create_status_icon(PURPLE_STATUS_INVISIBLE, parent, icon_size);
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2484 else if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_UNAVAILABLE))
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2485 status = pidgin_create_status_icon(PURPLE_STATUS_UNAVAILABLE, parent, icon_size);
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
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 }
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2488
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2489 /* If they don't have a buddy icon, then use the PRPL icon */
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2490 if (status == NULL) {
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2491 GtkIconSize size = gtk_icon_size_from_name(icon_size);
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2492 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) {
19899
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2493 status = gtk_widget_render_icon (parent, PIDGIN_STOCK_STATUS_PERSON,
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2494 size, "GtkWidget");
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2495 } else {
19899
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2496 status = gtk_widget_render_icon (parent, PIDGIN_STOCK_STATUS_CHAT,
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2497 size, "GtkWidget");
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2498 }
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2499 }
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2500 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
2501 }
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2502
19899
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2503 GdkPixbuf *
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2504 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
2505 {
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2506 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
2507 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
2508 }
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2509
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2510
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2511 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2512 update_tab_icon(PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2513 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2514 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2515 PidginWindow *win;
16315
ee4ce3c4186f Fix #248 (Control shouldn't steal focus from scrollback)
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16286
diff changeset
2516 GList *l;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2517 GdkPixbuf *status = NULL;
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2518 GdkPixbuf *infopane_status = NULL;
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2519 GdkPixbuf *emblem = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2520
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2521 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2522
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2523 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2524 win = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2525 if (conv != gtkconv->active_conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2526 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2527
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
2528 status = pidgin_conv_get_tab_icon(conv, TRUE);
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2529 infopane_status = pidgin_conv_get_tab_icon(conv, FALSE);
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2530
21991
cca516eb7610 Show the emblem in conversation infopane correctly for chats.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21951
diff changeset
2531 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
2532 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
2533 if (b)
cca516eb7610 Show the emblem in conversation infopane correctly for chats.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21951
diff changeset
2534 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
2535 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2536
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2537 g_return_if_fail(status != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2538
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2539 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon), status);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2540 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->menu_icon), status);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2541
18214
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2542 gtk_list_store_set(GTK_LIST_STORE(gtkconv->infopane_model),
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2543 &(gtkconv->infopane_iter),
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2544 CONV_ICON_COLUMN, infopane_status, -1);
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2545
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2546 gtk_list_store_set(GTK_LIST_STORE(gtkconv->infopane_model),
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2547 &(gtkconv->infopane_iter),
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2548 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
2549 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
2550 g_object_unref(emblem);
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2551
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
2552 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
2553 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
2554 } else {
fe546f9e3cbf Use the correct name for a preference. This will correctly update the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22678
diff changeset
2555 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
2556 }
fe546f9e3cbf Use the correct name for a preference. This will correctly update the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22678
diff changeset
2557
fe546f9e3cbf Use the correct name for a preference. This will correctly update the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22678
diff changeset
2558 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
2559 &(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
2560 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
2561 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
2562 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
2563
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
2564 /* 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
2565 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
2566 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
2567
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2568 if (status != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2569 g_object_unref(status);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2570
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2571 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
2572 (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
2573 gtkconv->u.im->anim == NULL))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2574 {
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2575 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
2576
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2577 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
2578 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2579 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2580
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
2581 #if 0
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2582 /* 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
2583 * 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
2584 * 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
2585 * 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
2586 * gets set back to FALSE
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2587 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2588 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
2589 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2590 PidginConversation *gtkconv = (PidginConversation *)data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2591 gtkconv->auto_resize = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2592 return FALSE;
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 #endif
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2595
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2596 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2597 redraw_icon(gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2598 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2599 PidginConversation *gtkconv = (PidginConversation *)data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2600 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2601 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2602 PurplePluginProtocolInfo *prpl_info = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2603
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2604 GdkPixbuf *buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2605 GdkPixbuf *scale;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2606 gint delay;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2607 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
2608 int size;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2609
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2610 gtkconv = PIDGIN_CONVERSATION(conv);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2611 account = purple_conversation_get_account(conv);
16604
598b66923c81 hopefully fix 236
Nathan Walp <nwalp@pidgin.im>
parents: 16577
diff changeset
2612
598b66923c81 hopefully fix 236
Nathan Walp <nwalp@pidgin.im>
parents: 16577
diff changeset
2613 if(account && account->gc) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2614 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(account->gc->prpl);
16604
598b66923c81 hopefully fix 236
Nathan Walp <nwalp@pidgin.im>
parents: 16577
diff changeset
2615 } else {
598b66923c81 hopefully fix 236
Nathan Walp <nwalp@pidgin.im>
parents: 16577
diff changeset
2616 gtkconv->u.im->icon_timer = 0;
598b66923c81 hopefully fix 236
Nathan Walp <nwalp@pidgin.im>
parents: 16577
diff changeset
2617 return FALSE;
598b66923c81 hopefully fix 236
Nathan Walp <nwalp@pidgin.im>
parents: 16577
diff changeset
2618 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2619
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2620 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
2621 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
2622
22733
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2623 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
2624 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
2625
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2626 gtk_widget_get_size_request(gtkconv->infopane_hbox, NULL, &size);
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2627 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
2628 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
2629
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2630 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
2631 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
2632 } 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
2633 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
2634 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
2635 } else {
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2636 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
2637 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
2638 }
18214
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2639
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2640 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
2641 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
2642 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
2643 pidgin_gdk_pixbuf_make_round(scale);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2644
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2645 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
2646 g_object_unref(G_OBJECT(scale));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2647 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
2648
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2649 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
2650
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2651 if (delay < 100)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2652 delay = 100;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2653
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2654 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
2655
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2656 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2657 }
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 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2660 start_anim(GtkObject *obj, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2661 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2662 int delay;
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 if (gtkconv->u.im->anim == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2665 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2666
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2667 if (gtkconv->u.im->icon_timer != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2668 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2669
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2670 if (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
2671 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2672
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2673 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
2674
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2675 if (delay < 100)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2676 delay = 100;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2677
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2678 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
2679 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2680
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2681 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2682 remove_icon(GtkWidget *widget, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2683 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2684 PurpleConversation *conv = gtkconv->active_conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2685 PidginWindow *gtkwin;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2686
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2687 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2688
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2689 if (gtkconv->u.im->icon_container != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2690 gtk_widget_destroy(gtkconv->u.im->icon_container);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2691
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2692 if (gtkconv->u.im->anim != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2693 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
2694
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2695 if (gtkconv->u.im->icon_timer != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2696 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
2697
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2698 if (gtkconv->u.im->iter != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2699 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
2700
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2701 gtkconv->u.im->icon_timer = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2702 gtkconv->u.im->icon = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2703 gtkconv->u.im->anim = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2704 gtkconv->u.im->iter = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2705 gtkconv->u.im->icon_container = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2706 gtkconv->u.im->show_icon = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2707
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2708 gtkwin = gtkconv->win;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2711 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2712 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
2713 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2714 PidginConversation *gtkconv = (PidginConversation *)user_data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2715 PurpleConversation *conv = gtkconv->active_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2716 FILE *fp;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2717 PurpleBuddyIcon *icon;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2718 const void *data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2719 size_t len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2720
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2721 if ((fp = g_fopen(filename, "wb")) == NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2722 purple_notify_error(gtkconv, NULL, _("Unable to open file."), NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2723 return;
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
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2726 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
2727 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
2728
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2729 if ((len <= 0) || (data == NULL) || (fwrite(data, 1, len, fp) != len)) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2730 purple_notify_error(gtkconv, NULL, _("Unable to save icon file to disk."), NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2731 fclose(fp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2732 g_unlink(filename);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2733 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2734 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2735 fclose(fp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2736 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2737
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2738 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2739 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
2740 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2741 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
2742 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
2743 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
2744 PurpleContact *contact;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2745 PidginConversation *gtkconv = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2746 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2747 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
2748
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 name = purple_conversation_get_name(conv);
23123
0ca259d5f928 Compile and de-warn.
Etan Reisner <pidgin@unreliablesource.net>
parents: 23122
diff changeset
2750 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
2751 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
2752 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
2753 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
2754 }
f6c57e6e8a89 Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <pidgin@unreliablesource.net>
parents: 23119
diff changeset
2755 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
2756
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_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
2758 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2759 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2760
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2761 static void
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2762 set_custom_icon_cb(GtkWidget *widget, PidginConversation *gtkconv)
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 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
2765 custom_icon_sel_cb, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2766 gtk_widget_show_all(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2767 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2768
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2769 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
2770 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
2771 {
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2772 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
2773 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
2774 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
2775
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2776 gtk_widget_get_size_request(gtkconv->infopane_hbox, NULL, &size);
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2777
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2778 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
2779 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
2780 } else {
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2781 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
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
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2784 gtk_widget_set_size_request(gtkconv->infopane_hbox, -1, size);
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2785 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
2786
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2787 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
2788 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
2789 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
2790 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
2791 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
2792 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
2793 }
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2794 }
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2795
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2796 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2797 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
2798 {
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
2799 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
2800 PurpleBuddy *buddy;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2801 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
2802 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
2803 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
2804
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2805 account = purple_conversation_get_account(conv);
23123
0ca259d5f928 Compile and de-warn.
Etan Reisner <pidgin@unreliablesource.net>
parents: 23122
diff changeset
2806 name = purple_conversation_get_name(conv);
0ca259d5f928 Compile and de-warn.
Etan Reisner <pidgin@unreliablesource.net>
parents: 23122
diff changeset
2807 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
2808 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
2809 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
2810 }
f6c57e6e8a89 Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <pidgin@unreliablesource.net>
parents: 23119
diff changeset
2811 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
2812
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 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
2814 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2815
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2816 static void
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2817 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
2818 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2819 PurpleConversation *conv = gtkconv->active_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2820 const gchar *ext;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2821 gchar *buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2822
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2823 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2824
16375
391a79778f89 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@wiktel.com>
parents: 16373
diff changeset
2825 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
2826
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2827 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
2828
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2829 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
2830 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
2831 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
2832 gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2833
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2834 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2835 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2836
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2837 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2838 stop_anim(GtkObject *obj, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2839 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2840 if (gtkconv->u.im->icon_timer != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2841 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
2842
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2843 gtkconv->u.im->icon_timer = 0;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2846
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2847 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2848 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
2849 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2850 gtkconv->u.im->animate =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2851 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
2852
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2853 if (gtkconv->u.im->animate)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2854 start_anim(NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2855 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2856 stop_anim(NULL, gtkconv);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2859 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2860 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
2861 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2862 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
2863 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
2864 PurpleBuddy *buddy;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2865
22733
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2866 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
2867 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
2868 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
2869 }
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2870
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 != 3 || e->type != GDK_BUTTON_PRESS) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2872 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
2873 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2874
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2875 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2876 * 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
2877 * thus freeing-up the memory it occupied.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2878 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2879 if (menu != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2880 gtk_widget_destroy(menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2881
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2882 menu = gtk_menu_new();
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 (gtkconv->u.im->anim &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2885 !(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
2886 {
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
2887 pidgin_new_check_item(menu, _("Animate"),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2888 G_CALLBACK(toggle_icon_animate_cb), gtkconv,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2889 gtkconv->u.im->icon_timer);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2890 }
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_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
2893 gtkconv, 0, 0, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2894
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
2895 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
2896 G_CALLBACK(icon_menu_save_cb), gtkconv,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2897 0, 0, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2898
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
2899 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
2900 G_CALLBACK(set_custom_icon_cb), gtkconv,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2901 0, 0, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2902
22733
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
2903 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
2904 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
2905 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
2906
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2907 /* 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
2908 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
2909 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
2910 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
2911 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
2912 {
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
2913 PurpleContact *contact = purple_buddy_get_contact(buddy);
23123
0ca259d5f928 Compile and de-warn.
Etan Reisner <pidgin@unreliablesource.net>
parents: 23122
diff changeset
2914 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
2915 {
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
2916 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
2917 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
2918 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
2919 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2920 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2921
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2922 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
2923
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2924 return TRUE;
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 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2928 * 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
2929 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2930 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2931 pidgin_conv_present_conversation(PurpleConversation *conv)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2932 {
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
2933 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
2934 GdkModifierType state;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2935
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
2936 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
2937 gtkconv = PIDGIN_CONVERSATION(conv);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
2938
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
2939 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
2940 /* 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
2941 * 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
2942 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
2943 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
2944 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
2945 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2946
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2947 GList *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2948 pidgin_conversations_find_unseen_list(PurpleConversationType type,
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
2949 PidginUnseenState min_state,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2950 gboolean hidden_only,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2951 guint max_count)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2952 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
2953 GList *l;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2954 GList *r = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2955 guint c = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2956
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2957 if (type == PURPLE_CONV_TYPE_IM) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2958 l = purple_get_ims();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2959 } else if (type == PURPLE_CONV_TYPE_CHAT) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2960 l = purple_get_chats();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2961 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2962 l = purple_get_conversations();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2963 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2964
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2965 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
2966 PurpleConversation *conv = (PurpleConversation*)l->data;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2967 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2968
19417
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
2969 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
2970 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2971
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2972 if (gtkconv->unseen_state >= min_state
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2973 && (!hidden_only ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2974 (hidden_only && gtkconv->win == hidden_convwin))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2975
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2976 r = g_list_prepend(r, conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2977 c++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2978 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2979 }
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 return r;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2982 }
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 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2985 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
2986 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2987 g_return_if_fail(conv != NULL);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
2988 pidgin_conv_present_conversation(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2989 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2990
19584
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2991 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
2992 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
2993 {
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2994 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
2995 /* 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
2996 * '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
2997 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
2998 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
2999 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
3000 }
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
3001 }
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
3002
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3003 guint
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3004 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
3005 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3006 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3007 guint ret=0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3008
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3009 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
3010 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
3011
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3012 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
3013 PurpleConversation *conv = (PurpleConversation*)l->data;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3014 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3015
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3016 GtkWidget *icon = gtk_image_new();
19899
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
3017 GdkPixbuf *pbuf = pidgin_conv_get_icon(conv, icon, PIDGIN_ICON_SIZE_TANGO_MICROSCOPIC);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3018 GtkWidget *item;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3019 gchar *text = g_strdup_printf("%s (%d)",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3020 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
3021 gtkconv->unseen_count);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3022
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3023 gtk_image_set_from_pixbuf(GTK_IMAGE(icon), pbuf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3024 g_object_unref(pbuf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3025
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3026 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
3027 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
3028 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
3029 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
3030 g_free(text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3031 ret++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3032 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3033
19584
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
3034 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
3035 /* 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
3036 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
3037 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
3038
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
3039 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
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 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
3042 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
3043 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
3044 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
3045 }
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
3046
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3047 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3048 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3049
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3050 PidginWindow *
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
3051 pidgin_conv_get_window(PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3052 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3053 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
3054 return gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3055 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3056
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3057 static GtkItemFactoryEntry menu_items[] =
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 /* Conversation menu */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3060 { N_("/_Conversation"), NULL, NULL, 0, "<Branch>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3061
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3062 { 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
3063 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW },
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3064
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3065 { "/Conversation/sep0", NULL, NULL, 0, "<Separator>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3066
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3067 { 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
3068 "<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
3069 { 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
3070 { 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
3071 "<StockItem>", GTK_STOCK_SAVE_AS },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3072 { 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
3073
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3074 { "/Conversation/sep1", NULL, NULL, 0, "<Separator>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3075
16839
d6ccf170148e New Send File icon
Hylke Bons <hylkebons@gmail.com>
parents: 16809
diff changeset
3076 { N_("/Conversation/Se_nd File..."), NULL, menu_send_file_cb, 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_SEND_FILE },
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3077 { 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
3078 0, "<Item>", NULL },
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3079 { 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
3080 "<StockItem>", PIDGIN_STOCK_TOOLBAR_USER_INFO },
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3081 { 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
3082 "<Item>", NULL },
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3083 { 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
3084
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3085 { "/Conversation/sep2", NULL, NULL, 0, "<Separator>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3086
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3087 { 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
3088 "<Item>", NULL },
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3089 { 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
3090 "<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
3091 { 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
3092 "<StockItem>", PIDGIN_STOCK_TOOLBAR_UNBLOCK },
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3093 { 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
3094 "<StockItem>", GTK_STOCK_ADD },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3095 { 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
3096 "<StockItem>", GTK_STOCK_REMOVE },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3097
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3098 { "/Conversation/sep3", NULL, NULL, 0, "<Separator>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3099
17776
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3100 { 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
3101 "<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
3102 { 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
3103 "<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
3104
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3105 { "/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
3106
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3107
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3108 { 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
3109 "<StockItem>", GTK_STOCK_CLOSE },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3110
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3111 /* Options */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3112 { N_("/_Options"), NULL, NULL, 0, "<Branch>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3113 { 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
3114 { 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
3115 { "/Options/sep0", NULL, NULL, 0, "<Separator>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3116 { 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
3117 { 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
3118 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3119
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3120 static const int menu_item_count =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3121 sizeof(menu_items) / sizeof(*menu_items);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3122
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3123 static const char *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3124 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
3125 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3126 return _(path);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3127 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3128
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3129 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3130 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
3131 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3132 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3133 PidginWindow *win = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3134 const char *method = value;
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 if (!strcmp(method, "none"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3137 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3138 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
3139 FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3140 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
3141 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3142 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3143 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3144 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
3145
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3146 if (gtkconv != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3147 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
3148 gtkconv->make_sound);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3149 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
3150
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3153
18658
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3154 /* 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
3155 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
3156 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
3157 {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3158 GList *list;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3159 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
3160 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
3161 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
3162 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
3163 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
3164
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3165 conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3166
17846
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3167 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
3168 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
3169
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3170 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
3171 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
3172 }
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3173
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3174 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
3175 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
3176 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
3177 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
3178 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
3179 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
3180 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
3181 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
3182 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
3183 } 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
3184 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
3185 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
3186 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
3187 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
3188 }
17846
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3189 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
3190 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
3191 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
3192 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
3193 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
3194 }
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3195 } 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
3196 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
3197 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
3198
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
3199 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
3200
17846
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3201 /* 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
3202 * 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
3203 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
3204 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
3205 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
3206 }
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3207
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3208 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
3209 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
3210 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
3211 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
3212 g_object_set_data_full(G_OBJECT(gtkconv->imhtml), "transient_buddy",
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3213 buddy, (GDestroyNotify)purple_blist_remove_buddy);
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3214 }
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3215 }
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3216 }
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3217
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
3218 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
3219 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
3220 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
3221 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
3222
18658
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3223 /* 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
3224 if (all) {
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
3225 if (buddy)
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
3226 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
3227 else if (chat) {
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
3228 /* XXX: */
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
3229 }
18658
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3230 } 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
3231 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
3232 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
3233 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
3234 }
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3235
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3236 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
3237 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
3238 } else {
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3239 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
3240 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
3241 }
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3242 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
3243 }
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3244
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3245 static void
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3246 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
3247 {
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3248 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
3249 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
3250 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
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 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
3253 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
3254
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3255 /* Remove the previous entries */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3256 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
3257 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3258 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
3259 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
3260 gtk_widget_destroy(w);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3261 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3262
18658
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3263 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
3264 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3265 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
3266 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
3267 gtk_widget_set_sensitive(item, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3268 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3269
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3270 gtk_widget_show_all(menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3271 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3272
17392
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3273 static void
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3274 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
3275 {
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3276 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
3277 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
3278 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
3279 }
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3280
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3281 static void
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3282 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
3283 {
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3284 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
3285 GtkWidget *menu;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3286 GList *list;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3287 PidginConversation *gtkconv;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3288 PurpleConversation *conv;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3289 GtkWidget *item;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3290
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
3291 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
3292 return;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3293
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3294 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
3295 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
3296 return;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3297
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3298 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
3299 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
3300
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3301 /* 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
3302 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
3303 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
3304 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
3305 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
3306 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
3307 }
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3308
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3309 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
3310
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3311 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
3312 if (list) {
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3313 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
3314 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
3315 }
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3316
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3317 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
3318 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
3319 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
3320 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
3321 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
3322 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
3323 }
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3324 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
3325 }
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3326
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3327 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
3328 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3329 PidginWindow *win = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3330 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
3331 regenerate_plugins_items(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3332
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3333 /* 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
3334 * 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
3335 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
3336 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
3337 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3338
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3339 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3340 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
3341 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3342 /* 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
3343 * the 'Conversation' menu pops up. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3344 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
3345 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
3346 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
3347 G_CALLBACK(focus_out_from_menubar), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3348 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3349
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3350 static GtkWidget *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3351 setup_menubar(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3352 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3353 GtkAccelGroup *accel_group;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3354 const char *method;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3355 GtkWidget *menuitem;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3356
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3357 accel_group = gtk_accel_group_new ();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3358 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
3359 g_object_unref(accel_group);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3360
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3361 win->menu.item_factory =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3362 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
3363
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3364 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
3365 (GtkTranslateFunc)item_factory_translate_func,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3366 NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3367
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3368 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
3369 menu_items, win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3370 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
3371 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
3372
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3373 /* 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
3374 * 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
3375 * conversation is created. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3376 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
3377 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
3378
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3379 win->menu.menubar =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3380 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
3381
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3382 win->menu.view_log =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3383 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
3384 N_("/Conversation/View Log"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3385
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3386 /* --- */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3387
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3388 win->menu.send_file =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3389 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
3390 N_("/Conversation/Send File..."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3391
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3392 win->menu.add_pounce =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3393 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
3394 N_("/Conversation/Add Buddy Pounce..."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3395
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3396 /* --- */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3397
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3398 win->menu.get_info =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3399 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
3400 N_("/Conversation/Get Info"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3401
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3402 win->menu.invite =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3403 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
3404 N_("/Conversation/Invite..."));
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 /* --- */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3407
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3408 win->menu.alias =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3409 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
3410 N_("/Conversation/Alias..."));
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 win->menu.block =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3413 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
3414 N_("/Conversation/Block..."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3415
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
3416 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
3417 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
3418 N_("/Conversation/Unblock..."));
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
3419
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3420 win->menu.add =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3421 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
3422 N_("/Conversation/Add..."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3423
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3424 win->menu.remove =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3425 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
3426 N_("/Conversation/Remove..."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3427
17776
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3428 /* --- */
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3429
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3430 win->menu.insert_link =
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3431 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
3432 N_("/Conversation/Insert Link..."));
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3433
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3434 win->menu.insert_image =
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3435 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
3436 N_("/Conversation/Insert Image..."));
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3437
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3438 /* --- */
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3439
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3440 win->menu.logging =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3441 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
3442 N_("/Options/Enable Logging"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3443 win->menu.sounds =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3444 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
3445 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
3446 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
3447 if (method != NULL && !strcmp(method, "none"))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3448 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3449 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
3450 FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3451 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
3452 }
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
3453 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
3454 sound_method_pref_changed_cb, win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3455
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3456 win->menu.show_formatting_toolbar =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3457 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
3458 N_("/Options/Show Formatting Toolbars"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3459 win->menu.show_timestamps =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3460 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
3461 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
3462 win->menu.show_icon = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3463
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3464 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
3465 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
3466 win->menu.tray);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3467 gtk_widget_show(win->menu.tray);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3468
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3469 gtk_widget_show(win->menu.menubar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3470
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3471 return win->menu.menubar;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3474
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3475 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3476 * Utility functions
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3477 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3478
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3479 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3480 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
3481 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3482 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3483 PurpleConvIm *im;
15374
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 * 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
3487 * send PURPLE_TYPED any time soon.
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3488 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3489
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3490 im = PURPLE_CONV_IM(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3491
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3492 purple_conv_im_stop_send_typed_timeout(im);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3493 purple_conv_im_start_send_typed_timeout(im);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3494
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3495 /* 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
3496 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
3497 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
3498 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3499 unsigned int timeout;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3500 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
3501 purple_conversation_get_name(conv),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3502 PURPLE_TYPING);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3503 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
3504 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3505 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3506
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
3507 #if 0
15725
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3508 static gboolean
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3509 typing_animation(gpointer data) {
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3510 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
3511 PidginWindow *gtkwin = gtkconv->win;
15725
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3512 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
3513
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
3514 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
3515 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
3516 }
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
3517
15725
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3518 switch (rand() % 5) {
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3519 case 0:
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3520 stock_id = PIDGIN_STOCK_ANIMATION_TYPING0;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3521 break;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3522 case 1:
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3523 stock_id = PIDGIN_STOCK_ANIMATION_TYPING1;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3524 break;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3525 case 2:
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3526 stock_id = PIDGIN_STOCK_ANIMATION_TYPING2;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3527 break;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3528 case 3:
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3529 stock_id = PIDGIN_STOCK_ANIMATION_TYPING3;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3530 break;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3531 case 4:
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3532 stock_id = PIDGIN_STOCK_ANIMATION_TYPING4;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3533 break;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3534 }
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3535 if (gtkwin->menu.typing_icon == NULL) {
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3536 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
3537 pidgin_menu_tray_append(PIDGIN_MENU_TRAY(gtkwin->menu.tray),
15725
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3538 gtkwin->menu.typing_icon,
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3539 _("User is typing..."));
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3540 } else {
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3541 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
3542 }
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3543 gtk_widget_show(gtkwin->menu.typing_icon);
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3544 return TRUE;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3545 }
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
3546 #endif
15725
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3547
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3548 static void
21875
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3549 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
3550 {
22612
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
3551 GtkTextBuffer *buffer;
21875
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3552 GtkTextMark *stmark, *enmark;
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3553
22612
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
3554 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
3555 return;
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
3556
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
3557 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
3558 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
3559 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
3560 if (stmark && enmark) {
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3561 GtkTextIter start, end;
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3562 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
3563 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
3564 gtk_text_buffer_delete_mark(buffer, stmark);
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3565 gtk_text_buffer_delete_mark(buffer, enmark);
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3566 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
3567 } 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
3568 message = NULL;
21875
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3569
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
3570 #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
3571 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
3572 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
3573 #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
3574
21875
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3575 if (message) {
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3576 GtkTextIter iter;
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3577 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
3578 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
3579 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
3580 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
3581 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
3582 }
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3583 }
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3584
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3585 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3586 update_typing_icon(PidginConversation *gtkconv)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3587 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3588 PidginWindow *gtkwin;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3589 PurpleConvIm *im = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3590 PurpleConversation *conv = gtkconv->active_conv;
21875
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3591 char *message = NULL;
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 gtkwin = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3594
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3595 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
3596 im = PURPLE_CONV_IM(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3597
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
3598 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
3599 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
3600
99bf55ec6ca4 Fix an invalid read that occurs because we were accessing IM data when the
Richard Laager <rlaager@wiktel.com>
parents: 16483
diff changeset
3601 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
3602 #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
3603 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
3604 #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
3605 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
3606 #endif
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3607 return;
15725
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3608 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3609
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3610 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
3611 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
3612 } else {
22038
13d290879e0a shorted the 'typing then stopped' message
Sean Egan <seanegan@gmail.com>
parents: 22037
diff changeset
3613 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
3614 }
13d290879e0a shorted the 'typing then stopped' message
Sean Egan <seanegan@gmail.com>
parents: 22037
diff changeset
3615
21875
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3616 update_typing_message(gtkconv, message);
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3617 g_free(message);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3618 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3619
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3620 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3621 update_send_to_selection(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3622 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3623 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3624 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3625 GtkWidget *menu;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3626 GList *child;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3627 PurpleBuddy *b;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3628
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3629 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
3630
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3631 if (conv == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3632 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3633
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3634 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3635
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3636 if (account == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3637 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3638
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3639 if (win->menu.send_to == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3640 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3641
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3642 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
3643 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3644
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3645
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3646 gtk_widget_show(win->menu.send_to);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3647
18658
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3648 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
3649
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3650 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
3651 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
3652 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
3653
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3654 GtkWidget *item = child->data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3655 PurpleBuddy *item_buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3656 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
3657 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
3658 "purple_buddy_name");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3659 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
3660
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3661 if (b == item_buddy) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3662 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
3663 g_list_free(child);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3664 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3665 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3666 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3667
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3668 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3669 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3670
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3671 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3672 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
3673 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3674 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
3675 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3676 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3677
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3678 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3679 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
3680 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3681 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
3682 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3683 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3684
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3685 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3686 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
3687 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3688 GtkWidget *box;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3689 GtkWidget *label;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3690 GtkWidget *image;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3691 GtkWidget *menuitem;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3692 GdkPixbuf *pixbuf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3693 gchar *text;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3694
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3695 /* Create a pixmap for the protocol icon. */
15542
a1e0b153fc30 prpl icons in Send To menu
Sean Egan <seanegan@gmail.com>
parents: 15534
diff changeset
3696 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
3697
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3698 /* Now convert it to GtkImage */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3699 if (pixbuf == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3700 image = gtk_image_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3701 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3702 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3703 image = gtk_image_new_from_pixbuf(pixbuf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3704 g_object_unref(G_OBJECT(pixbuf));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3705 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3706
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3707 gtk_size_group_add_widget(sg, image);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3708
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3709 /* Make our menu item */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3710 text = g_strdup_printf("%s (%s)", name, purple_account_get_username(account));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3711 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
3712 g_free(text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3713 *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
3714
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3715 /* 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
3716 box = gtk_hbox_new(FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3717
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3718 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
3719 g_object_ref(label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3720 gtk_container_remove(GTK_CONTAINER(menuitem), label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3721
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3722 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
3723 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
3724
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3725 if (buddy != NULL &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3726 !purple_presence_is_online(purple_buddy_get_presence(buddy)) &&
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3727 !purple_account_supports_offline_message(account, buddy))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3728 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3729 gtk_widget_set_sensitive(label, FALSE);
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 /* 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
3732 * 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
3733 * 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
3734 * (insensitive style) text.*/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3735 g_signal_connect(menuitem, "enter-notify-event",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3736 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
3737 g_signal_connect(menuitem, "leave-notify-event",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3738 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
3739 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3740
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3741 g_object_unref(label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3742
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3743 gtk_container_add(GTK_CONTAINER(menuitem), box);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3744
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3745 gtk_widget_show(label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3746 gtk_widget_show(image);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3747 gtk_widget_show(box);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3748
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3749 /* Set our data and callbacks. */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3750 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
3751 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
3752
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3753 g_signal_connect(G_OBJECT(menuitem), "activate",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3754 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
3755
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3756 gtk_widget_show(menuitem);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3757 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
3758 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3759
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
3760 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
3761 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
3762 {
35c7cd1e4771 Disable the 'send to' menu in converation windows if there's only one
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22725
diff changeset
3763 /* 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
3764 * 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
3765 */
35c7cd1e4771 Disable the 'send to' menu in converation windows if there's only one
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22725
diff changeset
3766 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
3767 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
3768 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
3769 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
3770 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
3771 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
3772 }
35c7cd1e4771 Disable the 'send to' menu in converation windows if there's only one
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22725
diff changeset
3773
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3774 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3775 generate_send_to_items(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3776 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3777 GtkWidget *menu;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3778 GSList *group = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3779 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
3780 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3781 GSList *l, *buds;
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 g_return_if_fail(win != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3784
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3785 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
3786
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3787 g_return_if_fail(gtkconv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3788
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3789 if (win->menu.send_to != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3790 gtk_widget_destroy(win->menu.send_to);
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 /* 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
3793 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
3794 gtk_widget_show(win->menu.send_to);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3795
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3796 menu = gtk_menu_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3797 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
3798 win->menu.send_to, 2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3799 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
3800
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3801 gtk_widget_show(menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3802
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3803 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
3804 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
3805
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3806 if (buds == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3807 {
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
3808 /* 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
3809 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3810 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3811 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3812 GList *list = NULL, *iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3813 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
3814 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3815 PurpleBlistNode *node;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3816
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3817 node = (PurpleBlistNode *) purple_buddy_get_contact((PurpleBuddy *)l->data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3818
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3819 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
3820 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3821 PurpleBuddy *buddy = (PurpleBuddy *)node;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3822 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3824 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
3825 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3826
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3827 account = purple_buddy_get_account(buddy);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3828 if (purple_account_is_connected(account))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3829 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3830 /* Use the PurplePresence to get unique buddies. */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3831 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
3832 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
3833 list = g_list_prepend(list, presence);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3834 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3835 }
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
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
3838 /* 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
3839 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
3840 /* 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
3841 * 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
3842 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
3843 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
3844 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
3845 create_sendto_item(menu, sg, &group, buddy,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3846 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
3847 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3848 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3849 g_list_free(list);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3850 g_slist_free(buds);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3851 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3852 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3853
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3854 g_object_unref(sg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3855
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3856 gtk_widget_show(win->menu.send_to);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3857 /* 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
3858 if (!group)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3859 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
3860 update_send_to_selection(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3861 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3862
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3863 static GdkPixbuf *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3864 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
3865 {
15672
0457791756e7 New chatlist icons. founder and ignored still needed.
Sean Egan <seanegan@gmail.com>
parents: 15632
diff changeset
3866 PidginConversation *gtkconv = PIDGIN_CONVERSATION(chat->conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3867 GdkPixbuf *pixbuf, *scale, *scale2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3868 char *filename;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3869 const char *image = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3870
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3871 if (flags & PURPLE_CBFLAGS_FOUNDER) {
15699
1229a0cd9126 docklet pending status
Sean Egan <seanegan@gmail.com>
parents: 15672
diff changeset
3872 image = PIDGIN_STOCK_STATUS_FOUNDER;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3873 } 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
3874 image = PIDGIN_STOCK_STATUS_OPERATOR;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3875 } 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
3876 image = PIDGIN_STOCK_STATUS_HALFOP;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3877 } 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
3878 image = PIDGIN_STOCK_STATUS_VOICE;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3879 } 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
3880 image = PIDGIN_STOCK_STATUS_IGNORED;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3881 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3882 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3883 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3884
15672
0457791756e7 New chatlist icons. founder and ignored still needed.
Sean Egan <seanegan@gmail.com>
parents: 15632
diff changeset
3885 pixbuf = gtk_widget_render_icon (gtkconv->tab_cont, image, gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL),
0457791756e7 New chatlist icons. founder and ignored still needed.
Sean Egan <seanegan@gmail.com>
parents: 15632
diff changeset
3886 "GtkTreeView");
16315
ee4ce3c4186f Fix #248 (Control shouldn't steal focus from scrollback)
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16286
diff changeset
3887
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3888 if (!pixbuf)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3889 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3890
15990
37d928a6579e these are 16x16 now
Nathan Walp <nwalp@pidgin.im>
parents: 15984
diff changeset
3891 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, GDK_INTERP_BILINEAR);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3892 g_object_unref(pixbuf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3893
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3894 if (flags && purple_conv_chat_is_user_ignored(chat, name)) {
16315
ee4ce3c4186f Fix #248 (Control shouldn't steal focus from scrollback)
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16286
diff changeset
3895 /* TODO: the .../status/default directory isn't installed, should it be? */
15885
c6e563dfaa7a More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
3896 filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "status", "default", "ignored.png", NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3897 pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3898 g_free(filename);
15990
37d928a6579e these are 16x16 now
Nathan Walp <nwalp@pidgin.im>
parents: 15984
diff changeset
3899 scale2 = gdk_pixbuf_scale_simple(pixbuf, 16, 16, GDK_INTERP_BILINEAR);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3900 g_object_unref(pixbuf);
15990
37d928a6579e these are 16x16 now
Nathan Walp <nwalp@pidgin.im>
parents: 15984
diff changeset
3901 gdk_pixbuf_composite(scale2, scale, 0, 0, 16, 16, 0, 0, 1, 1, GDK_INTERP_BILINEAR, 192);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3902 g_object_unref(scale2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3903 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3904
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3905 return scale;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3906 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3907
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3908 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3909 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
3910 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3911 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3912 PidginChatPane *gtkchat;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3913 PurpleConvChat *chat;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3914 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3915 PurplePluginProtocolInfo *prpl_info;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3916 GtkListStore *ls;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3917 GdkPixbuf *pixbuf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3918 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3919 gboolean is_me = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3920 gboolean is_buddy;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3921 gchar *tmp, *alias_key, *name, *alias;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3922 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
3923 GdkColor *color = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3924
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3925 alias = cb->alias;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3926 name = cb->name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3927 flags = GPOINTER_TO_INT(cb->flags);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3928
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3929 chat = PURPLE_CONV_CHAT(conv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3930 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3931 gtkchat = gtkconv->u.chat;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3932 gc = purple_conversation_get_gc(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3933
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3934 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
3935 return;
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 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
3938
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3939 pixbuf = get_chat_buddy_status_icon(chat, name, flags);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3940
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3941 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
3942 is_me = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3943
18305
ffd706ec0220 Set and use convchatbuddy->buddy.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18302
diff changeset
3944 is_buddy = cb->buddy;
15374
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 tmp = g_utf8_casefold(alias, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3947 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
3948 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3949
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
3950 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
3951 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
3952 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
3953 "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
3954 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
3955 } else {
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
3956 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
3957 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3958
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3959 #if GTK_CHECK_VERSION(2,6,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
3960 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
3961 /*
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
3962 * 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
3963 * 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
3964 * 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
3965 * 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
3966 * 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
3967 */
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
3968 -1, /* "row" */
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
3969 CHAT_USERS_ICON_COLUMN, pixbuf,
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
3970 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
3971 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
3972 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
3973 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
3974 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
3975 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
3976 -1);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3977 #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
3978 gtk_list_store_append(ls, &iter);
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
3979 gtk_list_store_set(ls, &iter,
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
3980 CHAT_USERS_ICON_COLUMN, pixbuf,
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
3981 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
3982 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
3983 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
3984 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
3985 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
3986 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
3987 -1);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3988 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3989
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3990 if (pixbuf)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3991 g_object_unref(pixbuf);
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
3992 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
3993 gdk_color_free(color);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3994 g_free(alias_key);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3995 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3996
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3997 static void
22781
e1052f4b0254 Modified patch from Andrei Mozzhuhin to fix tab-completion when non-ascii
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22733
diff changeset
3998 tab_complete_process_item(int *most_matched, char *entered, gsize entered_bytes, char **partial, char *nick_partial,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3999 GList **matches, gboolean command, char *name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4000 {
22781
e1052f4b0254 Modified patch from Andrei Mozzhuhin to fix tab-completion when non-ascii
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22733
diff changeset
4001 memcpy(nick_partial, name, entered_bytes);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4002 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
4003 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4004
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4005 /* 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
4006
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4007 if (*most_matched == -1) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4008 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4009 * 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
4010 * on *most_matched is >= 0
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4011 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4012 *most_matched = strlen(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4013 *partial = g_strdup(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4014 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4015 else if (*most_matched) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4016 char *tmp = g_strdup(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4017
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4018 while (purple_utf8_strcasecmp(tmp, *partial)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4019 (*partial)[*most_matched] = '\0';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4020 if (*most_matched < strlen(tmp))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4021 tmp[*most_matched] = '\0';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4022 (*most_matched)--;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4023 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4024 (*most_matched)++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4025
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4026 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4027 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4028
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4029 *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
4030 (GCompareFunc)purple_utf8_strcasecmp);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4031 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4032
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4033 static gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4034 tab_complete(PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4035 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4036 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4037 GtkTextIter cursor, word_start, start_buffer;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4038 int start;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4039 int most_matched = -1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4040 char *entered, *partial = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4041 char *text;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4042 char *nick_partial;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4043 const char *prefix;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4044 GList *matches = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4045 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
4046 gsize entered_bytes = 0;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4047
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4048 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4049
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4050 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
4051 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
4052 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
4053
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4054 word_start = cursor;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4055
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4056 /* if there's nothing there just return */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4057 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
4058 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
4059
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4060 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
4061 &cursor, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4062
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4063 /* 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
4064 start = strlen(text) - 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4065
22781
e1052f4b0254 Modified patch from Andrei Mozzhuhin to fix tab-completion when non-ascii
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22733
diff changeset
4066 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
4067 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
4068 }
e1052f4b0254 Modified patch from Andrei Mozzhuhin to fix tab-completion when non-ascii
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22733
diff changeset
4069
e1052f4b0254 Modified patch from Andrei Mozzhuhin to fix tab-completion when non-ascii
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22733
diff changeset
4070 /* 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
4071 * 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
4072 * 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
4073 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
4074 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
4075 /* 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
4076 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
4077 break;
e1052f4b0254 Modified patch from Andrei Mozzhuhin to fix tab-completion when non-ascii
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22733
diff changeset
4078 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4079 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4080
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4081 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
4082 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
4083 (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
4084 command = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4085 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
4086 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4087
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4088 g_free(text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4089
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4090 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
4091 &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
4092 entered_bytes = strlen(entered);
15374
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 if (!g_utf8_strlen(entered, -1)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4095 g_free(entered);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4096 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
4097 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4098
22781
e1052f4b0254 Modified patch from Andrei Mozzhuhin to fix tab-completion when non-ascii
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22733
diff changeset
4099 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
4100
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4101 if (command) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4102 GList *list = purple_cmd_list(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4103 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4104
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4105 /* Commands */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4106 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
4107 tab_complete_process_item(&most_matched, entered, entered_bytes, &partial, nick_partial,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4108 &matches, TRUE, l->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4109 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4110 g_list_free(list);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4111 } 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
4112 PurpleConvChat *chat = PURPLE_CONV_CHAT(conv);
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
4113 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
4114 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
4115 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4116 int f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4117
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4118 /* Users */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4119 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
4120 tab_complete_process_item(&most_matched, entered, entered_bytes, &partial, nick_partial,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4121 &matches, TRUE, ((PurpleConvChatBuddy *)l->data)->name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4122 }
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4125 /* Aliases */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4126 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
4127 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4128 do {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4129 char *name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4130 char *alias;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4131
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4132 gtk_tree_model_get(model, &iter,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4133 CHAT_USERS_NAME_COLUMN, &name,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4134 CHAT_USERS_ALIAS_COLUMN, &alias,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4135 -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4136
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
4137 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
4138 tab_complete_process_item(&most_matched, entered, entered_bytes, &partial, nick_partial,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4139 &matches, FALSE, alias);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4140 g_free(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4141 g_free(alias);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4142
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4143 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
4144 } while (f != 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4145 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4146 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4147 g_free(nick_partial);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4148 g_free(entered);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4149 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4150 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4151
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4152 g_free(nick_partial);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4153
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4154 /* 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
4155
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4156 /* if there weren't any matches, return */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4157 if (!matches) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4158 /* 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
4159 g_free(entered);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4160 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
4161 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4162
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4163 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
4164
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4165 if (!matches->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4166 /* 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
4167 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
4168 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
4169 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
4170
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4171 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
4172 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
4173 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
4174 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4175 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4176 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4177 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
4178 matches->data, -1);
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_free(matches->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4181 matches = g_list_remove(matches, matches->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4182 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4183 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4184 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4185 * 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
4186 * and display all of them
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 char *addthis = g_malloc0(1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4189
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4190 while (matches) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4191 char *tmp = addthis;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4192 addthis = g_strconcat(tmp, matches->data, " ", NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4193 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4194 g_free(matches->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4195 matches = g_list_remove(matches, matches->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4196 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4197
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4198 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
4199 time(NULL));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4200 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
4201 g_free(addthis);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4202 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4203
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4204 g_free(entered);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4205 g_free(partial);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4206
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4207 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4208 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4209
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4210 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
4211 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4212 PurplePluginProtocolInfo *prpl_info = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4213 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4214 PurpleConversation *conv = gtkconv->active_conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4215 PidginChatPane *gtkchat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4216 char *new_topic;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4217 const char *current_topic;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4218
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4219 gc = purple_conversation_get_gc(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4220
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4221 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
4222 return;
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 if(prpl_info->set_chat_topic == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4225 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4226
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4227 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4228 gtkchat = gtkconv->u.chat;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4229 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
4230 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
4231
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4232 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
4233 g_free(new_topic);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4234 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4235 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4236
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4237 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), current_topic);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4238 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
4239 new_topic);
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 g_free(new_topic);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4242 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4243
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4244 static gint
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4245 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
4246 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4247 PurpleConvChatBuddyFlags f1 = 0, f2 = 0;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4248 char *user1 = NULL, *user2 = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4249 gboolean buddy1 = FALSE, buddy2 = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4250 gint ret = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4251
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4252 gtk_tree_model_get(model, a,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4253 CHAT_USERS_ALIAS_KEY_COLUMN, &user1,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4254 CHAT_USERS_FLAGS_COLUMN, &f1,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4255 CHAT_USERS_WEIGHT_COLUMN, &buddy1,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4256 -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4257 gtk_tree_model_get(model, b,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4258 CHAT_USERS_ALIAS_KEY_COLUMN, &user2,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4259 CHAT_USERS_FLAGS_COLUMN, &f2,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4260 CHAT_USERS_WEIGHT_COLUMN, &buddy2,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4261 -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4262
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4263 if (user1 == NULL || user2 == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4264 if (!(user1 == NULL && user2 == NULL))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4265 ret = (user1 == NULL) ? -1: 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4266 } else if (f1 != f2) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4267 /* sort more important users first */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4268 ret = (f1 > f2) ? -1 : 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4269 } else if (buddy1 != buddy2) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4270 ret = (buddy1 > buddy2) ? -1 : 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4271 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4272 ret = strcmp(user1, user2);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4275 g_free(user1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4276 g_free(user2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4277
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4278 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4279 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4280
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4281 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4282 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
4283 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4284 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4285 PurpleConvChat *chat = PURPLE_CONV_CHAT(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4286 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4287 char *normalized_name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4288 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4289 int f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4290
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4291 g_return_if_fail(buddy != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4292 g_return_if_fail(conv != NULL);
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 /* 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
4295 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
4296
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4297 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
4298 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4299
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4300 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
4301
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4302 do {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4303 char *name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4304
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4305 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
4306
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4307 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
4308 const char *alias = name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4309 char *tmp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4310 char *alias_key = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4311 PurpleBuddy *buddy2;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4312
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4313 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
4314 /* 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
4315
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4316 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
4317 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
4318 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4319
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4320 tmp = g_utf8_casefold(alias, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4321 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
4322 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4323
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4324 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
4325 CHAT_USERS_ALIAS_COLUMN, alias,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4326 CHAT_USERS_ALIAS_KEY_COLUMN, alias_key,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4327 -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4328 g_free(alias_key);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4329 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4330 g_free(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4331 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4332 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4333
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4334 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
4335
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4336 g_free(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4337 } while (f != 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4338
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4339 g_free(normalized_name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4340 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4341
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4342 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4343 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
4344 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4345 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4346 PurplePluginProtocolInfo *prpl_info;
15374
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 g_return_if_fail(node != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4349 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4350
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4351 gc = purple_conversation_get_gc(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4352 g_return_if_fail(gc != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4353 g_return_if_fail(gc->prpl != NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4354 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
4355
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4356 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
4357 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4358
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4359 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
4360 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4361 PurpleBlistNode *bnode;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4362
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4363 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
4364
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4365 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
4366 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4367
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4368 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
4369 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4370 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4371 else if (PURPLE_BLIST_NODE_IS_BUDDY(node))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4372 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
4373 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
4374 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
4375 {
c30dae34dd33 Update the tab-title for chats immediately after aliasing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17106
diff changeset
4376 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
4377 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
4378 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4379 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4380
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4381 static void
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4382 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
4383 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4384 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4385 char *normalized_name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4386 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
4387 GtkTextTag *texttag;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4388 int f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4389
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4390 g_return_if_fail(buddy != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4391 g_return_if_fail(conv != NULL);
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 /* 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
4394 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
4395 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4396
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4397 /* 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
4398 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
4399
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4400 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
4401 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4402
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4403 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
4404
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4405 do {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4406 char *name;
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 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
4409
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4410 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
4411 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
4412 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
4413 g_free(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4414 break;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4417 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
4418
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4419 g_free(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4420 } while (f != 0);
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_free(normalized_name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4423
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4424 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
4425
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
4426 texttag = get_buddy_tag(conv, purple_buddy_get_name(buddy), FALSE); /* XXX: do we want the normalized 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
4427 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
4428 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
4429 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4430 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4431
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4432 static void
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4433 buddy_added_cb(PurpleBuddy *buddy, PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4434 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4435 buddy_cb_common(buddy, conv, TRUE);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4438 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4439 buddy_removed_cb(PurpleBuddy *buddy, PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4440 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4441 /* If there's another buddy for the same "dude" on the list, do nothing. */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4442 if (purple_find_buddy(buddy->account, buddy->name) != NULL)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4443 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4444
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4445 buddy_cb_common(buddy, conv, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4446 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4447
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4448 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
4449 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4450 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
4451 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4452
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4453 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4454 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
4455 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4456 GtkWidget *menuitem;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4457 PidginConversation *gtkconv = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4458
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4459 g_return_if_fail(menu != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4460 g_return_if_fail(gtkconv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4461
15560
442128853bdb toolbar/menu icons. reduce the imhtmltoolbar spacing. more gaimstock pruning
Sean Egan <seanegan@gmail.com>
parents: 15557
diff changeset
4462 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
4463 G_CALLBACK(send_menu_cb), gtkconv,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4464 0, 0, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4465 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
4466 gtk_widget_set_sensitive(menuitem, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4467 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
4468
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4469 menuitem = gtk_separator_menu_item_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4470 gtk_widget_show(menuitem);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4471 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
4472 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4473
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
4474 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
4475 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4476 GtkTextBuffer *buffer;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4477 GtkTextIter iter;
20837
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4478 int lines;
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4479 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
4480 int height, diff;
20837
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4481 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
4482 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
4483 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
4484 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
4485 int min_height;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4486
20837
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4487 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
4488 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
4489 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
4490
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
4491 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
4492 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
4493 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
4494
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
4495 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
4496
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
4497 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
4498 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
4499 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
4500 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
4501 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
4502 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
4503 } 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
4504 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
4505
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
4506 /* 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
4507 * 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
4508 * 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
4509 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
4510 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
4511
20839
83b662c458de uses the entry's allocated height instead of requested height, works around
Ka-Hing Cheung <khc@hxbc.us>
parents: 20838
diff changeset
4512 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
4513 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
4514 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
4515
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
4516 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
4517 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
4518
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
4519 return FALSE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4520 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4521
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4522 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
4523 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
4524 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
4525 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
4526 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
4527 {
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
4528 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
4529 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
4530 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
4531 {
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
4532 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
4533
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
4534 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
4535 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
4536
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
4537 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
4538 }
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
4539 }
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
4540
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
4541 static void
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4542 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
4543 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4544 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
4545 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
4546 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
4547 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
4548 {
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4549 GtkWidget *hbox, *label;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4550 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
4551
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
4552 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
4553 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
4554
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4555 label = gtk_label_new(_("Topic:"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4556 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
4557
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4558 gtkchat->topic_text = gtk_entry_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4559
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4560 if(prpl_info->set_chat_topic == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4561 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
4562 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4563 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
4564 G_CALLBACK(topic_callback), gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4565 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4566
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4567 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
4568 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
4569 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
4570 }
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4571 }
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4572
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
4573 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
4574 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
4575 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
4576 {
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4577 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
4578 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
4579 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
4580 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
4581 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
4582 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
4583 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
4584 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
4585
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4586 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
4587 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
4588
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4589 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
4590 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
4591
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4592 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
4593
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4594 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
4595 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
4596 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
4597 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
4598
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4599 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
4600 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
4601 }
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4602
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4603 static void
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4604 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
4605 {
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4606 PidginChatPane *gtkchat = gtkconv->u.chat;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4607 GtkWidget *lbox, *sw, *list;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4608 GtkListStore *ls;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4609 GtkCellRenderer *rend;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4610 GtkTreeViewColumn *col;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4611 int ul_width;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4612 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
4613 PurpleConversation *conv = gtkconv->active_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4614
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4615 /* Build the right pane. */
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
4616 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
4617 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
4618 gtk_widget_show(lbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4619
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4620 /* 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
4621 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
4622 #if GTK_CHECK_VERSION(2,6,0)
3c9711cf1a76 Ellipsize the "n people in room" text if necessary.
Will Thompson <will.thompson@collabora.co.uk>
parents: 23783
diff changeset
4623 gtk_label_set_ellipsize(GTK_LABEL(gtkchat->count), PANGO_ELLIPSIZE_END);
3c9711cf1a76 Ellipsize the "n people in room" text if necessary.
Will Thompson <will.thompson@collabora.co.uk>
parents: 23783
diff changeset
4624 #endif
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4625 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
4626 gtk_widget_show(gtkchat->count);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4627
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4628 /* Setup the list of users. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4629 sw = gtk_scrolled_window_new(NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4630 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
4631 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4632 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
4633 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
4634 gtk_widget_show(sw);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4635
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4636 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
4637 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4638 GDK_TYPE_COLOR, G_TYPE_INT);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4639 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
4640 sort_chat_users, NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4641
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4642 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
4643
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4644 rend = gtk_cell_renderer_pixbuf_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4645
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4646 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
4647 "pixbuf", CHAT_USERS_ICON_COLUMN, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4648 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
4649 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
4650 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
4651 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
4652
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
4653 /* 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
4654 * 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
4655 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
4656 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
4657
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4658 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
4659 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
4660 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
4661 G_CALLBACK(activate_list_cb), gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4662 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
4663 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
4664 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
4665
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
4666 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
4667 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
4668
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4669 rend = gtk_cell_renderer_text_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4670 g_object_set(rend,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4671 "foreground-set", TRUE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4672 "weight-set", TRUE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4673 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
4674 g_object_set(G_OBJECT(rend), "editable", TRUE, NULL);
aafa9b36344e Double-click infopane to alias or change topic. Also, show alias instead of screenname in infopane
Sean Egan <seanegan@gmail.com>
parents: 19231
diff changeset
4675
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4676 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
4677 "text", CHAT_USERS_ALIAS_COLUMN,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4678 "foreground-gdk", CHAT_USERS_COLOR_COLUMN,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4679 "weight", CHAT_USERS_WEIGHT_COLUMN,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4680 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4681
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4682 purple_signal_connect(blist_handle, "buddy-added",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4683 gtkchat, PURPLE_CALLBACK(buddy_added_cb), conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4684 purple_signal_connect(blist_handle, "buddy-removed",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4685 gtkchat, PURPLE_CALLBACK(buddy_removed_cb), conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4686 purple_signal_connect(blist_handle, "blist-node-aliased",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4687 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
4688
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4689 #if GTK_CHECK_VERSION(2,6,0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4690 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
4691 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
4692 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4693
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4694 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
4695
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4696 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
4697 gtk_widget_show(list);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4698
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4699 gtkchat->list = list;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4700
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4701 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
4702 }
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4703
18671
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4704 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
4705 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
4706 {
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4707 PurpleBlistNode *node = NULL;
19227
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4708 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
4709 PidginConversation *gtkconv = userdata;
19227
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4710
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4711 conv = gtkconv->active_conv;
19226
a0d45fa8ecfc De-seaneganify some of the indentation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19223
diff changeset
4712 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
4713 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
4714 if (!node)
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4715 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
4716 } else {
19226
a0d45fa8ecfc De-seaneganify some of the indentation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19223
diff changeset
4717 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
4718 #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
4719 /* 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
4720 if (!node)
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4721 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
4722 #endif
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4723 }
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4724
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4725 if (node)
18671
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4726 pidgin_blist_draw_tooltip(node, gtkconv->infopane);
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4727 return FALSE;
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4728 }
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4729
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4730 static GtkWidget *
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4731 setup_common_pane(PidginConversation *gtkconv)
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4732 {
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
4733 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
4734 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
4735 GtkTreePath *path;
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4736 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
4737 PurpleBuddy *buddy;
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4738 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
4739 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
4740 int buddyicon_size = 0;
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4741
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4742 /* 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
4743 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
4744 gtk_widget_show(vbox);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4745
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
4746 /* 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
4747 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
4748 #if GTK_CHECK_VERSION(2,4,0)
e47ff6610fc7 Make eventbox input only in infopane. Thanks fmoo.
Sean Egan <seanegan@gmail.com>
parents: 18631
diff changeset
4749 gtk_event_box_set_visible_window(GTK_EVENT_BOX(event_box), FALSE);
e47ff6610fc7 Make eventbox input only in infopane. Thanks fmoo.
Sean Egan <seanegan@gmail.com>
parents: 18631
diff changeset
4750 #endif
18227
cbc89a49e43b Treat infopanes just like tabs for purposes of drag-and-drop. Then, don't show a tab for windows with only one tab, as the infopane serves the purpose better
Sean Egan <seanegan@gmail.com>
parents: 18218
diff changeset
4751 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
4752 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
4753 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
4754 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
4755 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
4756 gtk_widget_add_events(event_box,
18671
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4757 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
4758 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
4759 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
4760
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
4761 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
4762 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
4763
a8c701d877aa Start work on blist pane in conversation. Looks like: http://pidgin.im/~seanegan/infopane.png Certainly much to be done yet.
Sean Egan <seanegan@gmail.com>
parents: 18167
diff changeset
4764 gtkconv->infopane = gtk_cell_view_new();
19474
74befdcd0454 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@gmail.com>
parents: 19468
diff changeset
4765 gtkconv->infopane_model = gtk_list_store_new(CONV_NUM_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, GDK_TYPE_PIXBUF, GDK_TYPE_PIXBUF);
18214
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
4766 gtk_cell_view_set_model(GTK_CELL_VIEW(gtkconv->infopane),
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
4767 GTK_TREE_MODEL(gtkconv->infopane_model));
22678
01b5c9ed85e7 Leak fix. I think. At least valgrind stopped crying about it and nothing
Stu Tomlinson <stu@nosnilmot.com>
parents: 22669
diff changeset
4768 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
4769 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
4770 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
4771 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
4772 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
4773 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
4774
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
4775 if ((buddy = purple_find_buddy(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
4776 purple_conversation_get_name(conv))) != NULL) {
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
4777 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
4778 if (contact) {
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
4779 buddyicon_size = purple_blist_node_get_int((PurpleBlistNode*)contact, "pidgin-infopane-iconsize");
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
4780 }
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
4781 }
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
4782 buddyicon_size = CLAMP(buddyicon_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
4783 gtk_widget_set_size_request(gtkconv->infopane_hbox, -1, buddyicon_size);
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
4784 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
4785
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
4786 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
4787 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(gtkconv->infopane), rend, FALSE);
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
4788 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(gtkconv->infopane), rend, "pixbuf", CONV_ICON_COLUMN, NULL);
18218
571e0ca28d6c Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18215
diff changeset
4789 g_object_set(rend, "xalign", 0.0, "xpad", 6, "ypad", 0, NULL);
18181
a8c701d877aa Start work on blist pane in conversation. Looks like: http://pidgin.im/~seanegan/infopane.png Certainly much to be done yet.
Sean Egan <seanegan@gmail.com>
parents: 18167
diff changeset
4790
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
4791 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
4792 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
4793 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
4794 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
4795
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
4796 #if GTK_CHECK_VERSION(2, 6, 0)
b2578b2d4bc4 Remove X11 specifics from configure.ac. Allows to build against native, non-X11 Quartz
Sean Egan <seanegan@gmail.com>
parents: 19474
diff changeset
4797 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
4798 #endif
b2578b2d4bc4 Remove X11 specifics from configure.ac. Allows to build against native, non-X11 Quartz
Sean Egan <seanegan@gmail.com>
parents: 19474
diff changeset
4799
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
4800 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
4801 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
4802 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
4803 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
4804
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
4805 rend = gtk_cell_renderer_pixbuf_new();
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
4806 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
4807 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
4808 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
4809
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4810 /* Setup the gtkimhtml widget */
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4811 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
4812 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
4813 if (chat) {
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4814 GtkWidget *hpaned;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4815
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4816 /* Add the topic */
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4817 setup_chat_topic(gtkconv, vbox);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4818
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4819 /* Add the gtkimhtml frame */
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4820 hpaned = gtk_hpaned_new();
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4821 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
4822 gtk_widget_show(hpaned);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4823 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
4824
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4825 /* Now add the userlist */
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4826 setup_chat_userlist(gtkconv, hpaned);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4827 } else {
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4828 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
4829 }
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4830 gtk_widget_show(frame);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4831
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4832 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
4833 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml),TRUE);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4834
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4835 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
4836 &imhtml_sw_hscroll, NULL);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4837 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
4838 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
4839
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4840 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
4841 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
4842 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
4843 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
4844 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
4845 G_CALLBACK(refocus_entry_cb), gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4846
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
4847 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
4848 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
4849 gtk_widget_show(gtkconv->lower_hbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4850
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4851 /* 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
4852 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
4853 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
4854 gtk_widget_show(frame);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4855
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
4856 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
4857 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
4858 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
4859
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4860 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
4861 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
4862 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
4863 G_CALLBACK(entry_key_press_cb), gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4864 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
4865 G_CALLBACK(send_cb), gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4866 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
4867 G_CALLBACK(entry_stop_rclick_cb), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4868
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4869 gtkconv->entry_buffer =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4870 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
4871 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
4872
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4873 if (!chat) {
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4874 /* 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
4875 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
4876 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
4877 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
4878 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
4879 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
4880 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
4881 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
4882 }
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4883
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4884 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
4885 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
4886 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
4887 G_CALLBACK(resize_imhtml_cb), gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4888
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4889 default_formatize(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4890 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
4891 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
4892 return vbox;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4893 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4894
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4895 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4896 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
4897 GtkSelectionData *sd, guint info, guint t,
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4898 PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4899 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4900 PurpleConversation *conv = gtkconv->active_conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4901 PidginWindow *win = gtkconv->win;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4902 PurpleConversation *c;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4903 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
4904 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4905 PurpleBlistNode *n = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4906 PurpleBuddy *b;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4907 PidginConversation *gtkconv = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4908
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4909 n = *(PurpleBlistNode **)sd->data;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4910
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4911 if (PURPLE_BLIST_NODE_IS_CONTACT(n))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4912 b = purple_contact_get_priority_buddy((PurpleContact*)n);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4913 else if (PURPLE_BLIST_NODE_IS_BUDDY(n))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4914 b = (PurpleBuddy*)n;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4915 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4916 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4917
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4918 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4919 * If we already have an open conversation with this buddy, then
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4920 * just move the conv to this window. Otherwise, create a new
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4921 * conv and add it to this window.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4922 */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4923 c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, b->name, b->account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4924 if (c != NULL) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4925 PidginWindow *oldwin;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4926 gtkconv = PIDGIN_CONVERSATION(c);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4927 oldwin = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4928 if (oldwin != win) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4929 pidgin_conv_window_remove_gtkconv(oldwin, gtkconv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4930 pidgin_conv_window_add_gtkconv(win, gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4931 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4932 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4933 c = purple_conversation_new(PURPLE_CONV_TYPE_IM, b->account, b->name);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4934 gtkconv = PIDGIN_CONVERSATION(c);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4935 if (gtkconv->win != win)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4936 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4937 pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4938 pidgin_conv_window_add_gtkconv(win, gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4939 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4940 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4941
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4942 /* Make this conversation the active conversation */
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4943 pidgin_conv_window_switch_gtkconv(win, gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4944
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4945 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
4946 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4947 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
4948 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4949 char *protocol = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4950 char *username = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4951 PurpleAccount *account;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4952 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4953
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4954 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
4955 &protocol, &username, NULL))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4956 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4957 if (account == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4958 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4959 purple_notify_error(win, NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4960 _("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
4961 "can add that buddy."), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4962 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4963 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4964 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4965 c = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, username);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4966 gtkconv = PIDGIN_CONVERSATION(c);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4967 if (gtkconv->win != win)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4968 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4969 pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4970 pidgin_conv_window_add_gtkconv(win, gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4971 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4972 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4973 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4974
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4975 g_free(username);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4976 g_free(protocol);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4977
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4978 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
4979 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4980 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
4981 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
4982 pidgin_dnd_file_manage(sd, purple_conversation_get_account(conv), purple_conversation_get_name(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4983 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
4984 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4985 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4986 gtk_drag_finish(dc, FALSE, FALSE, t);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4987 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4988
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4989
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4990 static const GtkTargetEntry te[] =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4991 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4992 GTK_IMHTML_DND_TARGETS,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4993 {"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
4994 {"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
4995 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4996
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4997 static PidginConversation *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4998 pidgin_conv_find_gtkconv(PurpleConversation * conv)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4999 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5000 PurpleBuddy *bud = purple_find_buddy(conv->account, conv->name), *b;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5001 PurpleContact *c;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5002 PurpleBlistNode *cn;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5003
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5004 if (!bud)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5005 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5006
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5007 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
5008 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5009
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5010 cn = (PurpleBlistNode *)c;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5011 for (b = (PurpleBuddy *)cn->child; b; b = (PurpleBuddy *) ((PurpleBlistNode *)b)->next) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5012 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5013 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
5014 if (conv->ui_data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5015 return conv->ui_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5016 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5017 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5018
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5019 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5020 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5021
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5022 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5023 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
5024 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5025 GList *list;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5026
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5027 g_return_if_fail(bnode);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5028 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(bnode));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5029
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5030 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
5031 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5032 PidginWindow *win = list->data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5033 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
5034
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5035 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
5036 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5037
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
5038 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
5039 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5040 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5041
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
5042 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
5043 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
5044 {
b079dad9d569 Stop propagating a middle-click on the pane-handle to the notebook below.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17107
diff changeset
5045 /* 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
5046 * 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
5047 * 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
5048 */
b079dad9d569 Stop propagating a middle-click on the pane-handle to the notebook below.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17107
diff changeset
5049 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
5050 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
5051 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
5052 }
b079dad9d569 Stop propagating a middle-click on the pane-handle to the notebook below.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17107
diff changeset
5053
22612
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5054 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
5055 {
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5056 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
5057 static GdkColor *color = NULL;
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5058 static gboolean enable = TRUE;
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5059
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5060 if (font_desc == NULL) {
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5061 char *string = NULL;
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5062 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
5063 "typing-notification-font", &string,
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5064 "typing-notification-color", &color,
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5065 "typing-notification-enable", &enable,
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5066 NULL);
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5067 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
5068 g_free(string);
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5069 if (color == NULL) {
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5070 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
5071 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
5072 }
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5073 }
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5074
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5075 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
5076 "foreground-gdk", color,
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5077 "font-desc", font_desc,
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5078 NULL);
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5079
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5080 if (!enable) {
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5081 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
5082 /* 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
5083 }
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5084
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5085 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
5086 }
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5087
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5088 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5089 * Conversation UI operations
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5090 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5091 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5092 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
5093 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5094 PidginConversation *gtkconv;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5095 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
5096 GtkWidget *pane = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5097 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
5098 PurpleBlistNode *convnode;
22009
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
5099 PurpleValue *value;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5100
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5101 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
5102 conv->ui_data = gtkconv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5103 if (!g_list_find(gtkconv->convs, conv))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5104 gtkconv->convs = g_list_prepend(gtkconv->convs, conv);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
5105 pidgin_conv_switch_active_conversation(conv);
15374
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5108
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5109 gtkconv = g_new0(PidginConversation, 1);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5110 conv->ui_data = gtkconv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5111 gtkconv->active_conv = conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5112 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
5113 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
5114
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5115 /* Setup some initial variables. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5116 gtkconv->tooltips = gtk_tooltips_new();
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
5117 gtkconv->unseen_state = PIDGIN_UNSEEN_NONE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5118 gtkconv->unseen_count = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5119
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5120 if (conv_type == PURPLE_CONV_TYPE_IM) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5121 gtkconv->u.im = g_malloc0(sizeof(PidginImPane));
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5122 } 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
5123 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
5124 }
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
5125 pane = setup_common_pane(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5126
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5127 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
5128 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
5129
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5130 if (pane == NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5131 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
5132 g_free(gtkconv->u.chat);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5133 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
5134 g_free(gtkconv->u.im);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5135
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5136 g_free(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5137 conv->ui_data = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5138 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5139 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5140
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5141 /* Setup drag-and-drop */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5142 gtk_drag_dest_set(pane,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5143 GTK_DEST_DEFAULT_MOTION |
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5144 GTK_DEST_DEFAULT_DROP,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5145 te, sizeof(te) / sizeof(GtkTargetEntry),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5146 GDK_ACTION_COPY);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5147 gtk_drag_dest_set(pane,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5148 GTK_DEST_DEFAULT_MOTION |
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5149 GTK_DEST_DEFAULT_DROP,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5150 te, sizeof(te) / sizeof(GtkTargetEntry),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5151 GDK_ACTION_COPY);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5152 gtk_drag_dest_set(gtkconv->imhtml, 0,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5153 te, sizeof(te) / sizeof(GtkTargetEntry),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5154 GDK_ACTION_COPY);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5155
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5156 gtk_drag_dest_set(gtkconv->entry, 0,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5157 te, sizeof(te) / sizeof(GtkTargetEntry),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5158 GDK_ACTION_COPY);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5159
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
5160 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
5161 G_CALLBACK(ignore_middle_click), NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5162 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
5163 G_CALLBACK(conv_dnd_recv), gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5164 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
5165 G_CALLBACK(conv_dnd_recv), gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5166 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
5167 G_CALLBACK(conv_dnd_recv), gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5168
22612
98775a5b4817 Customize/disable the typing notification from gtkrc-2.0.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22601
diff changeset
5169 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
5170
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5171 /* Setup the container for the tab. */
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
5172 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
5173 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
5174 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
5175 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
5176 gtk_widget_show(pane);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5177
19980
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
5178 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
5179 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
5180 gtkconv->make_sound = TRUE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5181
22009
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
5182 if (convnode != NULL &&
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
5183 (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
5184 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
5185 {
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
5186 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
5187 }
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
5188
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
5189 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
5190 gtk_widget_show(gtkconv->toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5191 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5192 gtk_widget_hide(gtkconv->toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5193
18602
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
5194 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
5195 gtk_widget_show(gtkconv->infopane_hbox);
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
5196 else
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
5197 gtk_widget_hide(gtkconv->infopane_hbox);
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
5198
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5199 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
5200 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
5201 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
5202 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
5203
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5204 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
5205 G_CALLBACK(gtk_widget_grab_focus),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5206 gtkconv->entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5207
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5208 if (hidden)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5209 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
5210 else
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
5211 pidgin_conv_placement_place(gtkconv);
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 (nick_colors == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5214 nbr_nick_colors = NUM_NICK_COLORS;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5215 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
5216 }
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
5217
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
5218 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
5219 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
5220 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5221
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5222 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5223 pidgin_conv_new_hidden(PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5224 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5225 private_gtkconv_new(conv, TRUE);
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 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5229 pidgin_conv_new(PurpleConversation *conv)
15374
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 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
5232 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
5233 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
5234 "conversation-displayed", PIDGIN_CONVERSATION(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5235 }
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 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5238 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
5239 PurpleConversation *conv, PurpleMessageFlags flags)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5240 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5241 PurpleConversationUiOps *ui_ops = pidgin_conversations_get_conv_ui_ops();
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5242 gboolean hide = FALSE;
19897
922960f829f9 disapproval of revision '08f542359200866bb7a302653d875cdeccb8df01'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
5243
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5244 /* 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
5245 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
5246 hide = TRUE;
19897
922960f829f9 disapproval of revision '08f542359200866bb7a302653d875cdeccb8df01'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
5247
922960f829f9 disapproval of revision '08f542359200866bb7a302653d875cdeccb8df01'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
5248 /* 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
5249 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
5250 !purple_status_is_available(purple_account_get_active_status(account)))
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5251 hide = TRUE;
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5252
21772
21371ea85970 Fix boldifying the chat entries in the buddylist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21766
diff changeset
5253 if (conv && PIDGIN_IS_PIDGIN_CONVERSATION(conv) && !hide) {
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5254 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5255 if (gtkconv->win == hidden_convwin) {
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5256 pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv);
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5257 pidgin_conv_placement_place(gtkconv);
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5258 }
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5259 return;
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5260 }
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5261
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5262 if (hide) {
19897
922960f829f9 disapproval of revision '08f542359200866bb7a302653d875cdeccb8df01'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
5263 ui_ops->create_conversation = pidgin_conv_new_hidden;
922960f829f9 disapproval of revision '08f542359200866bb7a302653d875cdeccb8df01'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
5264 purple_conversation_new(PURPLE_CONV_TYPE_IM, account, sender);
922960f829f9 disapproval of revision '08f542359200866bb7a302653d875cdeccb8df01'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
5265 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
5266 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5267 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5268
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5269 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5270 pidgin_conv_destroy(PurpleConversation *conv)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5271 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5272 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5273
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5274 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
5275 /* 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
5276 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
5277 /* 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
5278 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
5279 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
5280 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
5281 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5282 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
5283 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5284
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5285 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
5286
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5287 /* 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
5288 purple_request_close_with_handle(gtkconv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5289 purple_notify_close_with_handle(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5290
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5291 gtk_widget_destroy(gtkconv->tab_cont);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5292 g_object_unref(gtkconv->tab_cont);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5293
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5294 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
5295 if (gtkconv->u.im->icon_timer != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5296 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
5297
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5298 if (gtkconv->u.im->anim != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5299 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
5300
16273
143b508024c0 Patch from khc to remove the typing notifcation callback when the window is
Stu Tomlinson <stu@nosnilmot.com>
parents: 16229
diff changeset
5301 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
5302 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
5303
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5304 g_free(gtkconv->u.im);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5305 } 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
5306 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
5307 g_free(gtkconv->u.chat);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5308 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5309
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5310 gtk_object_sink(GTK_OBJECT(gtkconv->tooltips));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5311
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5312 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
5313 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
5314 g_list_free(gtkconv->send_history);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5315
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
5316 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
5317 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
5318 }
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
5319
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5320 g_free(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5321 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5322
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5323
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5324 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5325 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
5326 const char *message, PurpleMessageFlags flags,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5327 time_t mtime)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5328 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5329 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5330
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5331 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5332
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5333 if (conv != gtkconv->active_conv &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5334 flags & PURPLE_MESSAGE_ACTIVE_ONLY)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5335 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5336 /* 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
5337 * 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
5338 * before being written to the log. */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5339 purple_debug_info("gtkconv",
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
5340 "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
5341 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5342 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5343
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5344 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
5345 }
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 /* 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
5348 static gboolean buddytag_event(GtkTextTag *tag, GObject *imhtml,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5349 GdkEvent *event, GtkTextIter *arg2, gpointer data) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5350 if (event->type == GDK_BUTTON_PRESS
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5351 || event->type == GDK_2BUTTON_PRESS) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5352 GdkEventButton *btn_event = (GdkEventButton*) event;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5353 PurpleConversation *conv = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5354 char *buddyname;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5355
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5356 /* strlen("BUDDY ") == 6 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5357 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
5358 && (strlen(tag->name) > 6), FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5359
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5360 buddyname = (tag->name) + 6;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5361
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5362 if (btn_event->button == 2
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5363 && event->type == GDK_2BUTTON_PRESS) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5364 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
5365
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5366 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5367 } else if (btn_event->button == 3
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5368 && event->type == GDK_BUTTON_PRESS) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5369 GtkTextIter start, end;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5370
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5371 /* we shouldn't display the popup
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5372 * if the user has selected something: */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5373 if (!gtk_text_buffer_get_selection_bounds(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5374 gtk_text_iter_get_buffer(arg2),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5375 &start, &end)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5376 GtkWidget *menu = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5377 PurpleConnection *gc =
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5378 purple_conversation_get_gc(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5379
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5380
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5381 menu = create_chat_menu(conv, buddyname, gc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5382 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
5383 NULL, GTK_WIDGET(imhtml),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5384 btn_event->button,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5385 btn_event->time);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5386
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5387 /* Don't propagate the event any further */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5388 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5389 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5390 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5391 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5392
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5393 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5394 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5395
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
5396 static GtkTextTag *get_buddy_tag(PurpleConversation *conv, const char *who, gboolean create)
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
5397 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5398 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5399 GtkTextTag *buddytag;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5400 gchar *str;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5401
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5402 str = g_strdup_printf("BUDDY %s", who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5403
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5404 buddytag = gtk_text_tag_table_lookup(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5405 gtk_text_buffer_get_tag_table(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5406 GTK_IMHTML(gtkconv->imhtml)->text_buffer), str);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5407
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
5408 if (buddytag == NULL && create) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5409 buddytag = gtk_text_buffer_create_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
5410 GTK_IMHTML(gtkconv->imhtml)->text_buffer, str,
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
5411 "foreground-gdk", get_nick_color(gtkconv, who),
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
5412 "weight", purple_find_buddy(purple_conversation_get_account(conv), who) ? 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
5413 NULL);
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(G_OBJECT(buddytag), "event",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5416 G_CALLBACK(buddytag_event), conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5417 }
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 g_free(str);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5420
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5421 return buddytag;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5422 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5423
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
5424 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
5425 {
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5426 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
5427
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5428 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
5429 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
5430
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5431 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
5432 }
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5433
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5434 /* Detect string direction and encapsulate the string in RLE/LRE/PDF unicode characters
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5435 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
5436 static void
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5437 str_embed_direction_chars(char **str)
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5438 {
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
5439 #ifdef HAVE_PANGO14
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5440 char pre_str[4];
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5441 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
5442 char *ret;
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5443
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5444 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
5445 {
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
5446 sprintf(pre_str, "%c%c%c",
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5447 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
5448 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
5449 0xE2, 0x80, 0xAC, /* PDF */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5450 0xE2, 0x80, 0x8E, /* LRM */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5451 0xE2, 0x80, 0xAC); /* PDF */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5452 }
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5453 else
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5454 {
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
5455 sprintf(pre_str, "%c%c%c",
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5456 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
5457 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
5458 0xE2, 0x80, 0xAC, /* PDF */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5459 0xE2, 0x80, 0x8F, /* RLM */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5460 0xE2, 0x80, 0xAC); /* PDF */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5461 }
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5462
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
5463 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
5464
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5465 g_free(*str);
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5466 *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
5467 #endif
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5468 }
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5469
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5470 /* Returns true if the given HTML contains RTL text */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5471 static gboolean
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5472 html_is_rtl(const char *html)
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5473 {
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5474 GData *attributes;
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5475 const gchar *start, *end;
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5476 gboolean res = FALSE;
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5477
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5478 if (purple_markup_find_tag("span", html, &start, &end, &attributes))
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5479 {
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5480 /* tmp is a member of attributes and is free with g_datalist_clear call */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5481 const char *tmp = g_datalist_get_data(&attributes, "dir");
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5482 if (tmp && !g_ascii_strcasecmp(tmp, "RTL"))
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5483 res = TRUE;
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5484 if (!res)
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5485 {
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5486 tmp = g_datalist_get_data(&attributes, "style");
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5487 if (tmp)
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5488 {
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5489 char *tmp2 = purple_markup_get_css_property(tmp, "direction");
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5490 if (tmp2 && !g_ascii_strcasecmp(tmp2, "RTL"))
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5491 res = TRUE;
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5492 g_free(tmp2);
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5493 }
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5494
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5495 }
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5496 g_datalist_clear(&attributes);
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5497 }
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5498 return res;
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5499 }
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5500
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5501
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5502 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5503 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
5504 const char *message, PurpleMessageFlags flags,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5505 time_t mtime)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5506 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5507 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5508 PidginWindow *win;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5509 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5510 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5511 PurplePluginProtocolInfo *prpl_info;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5512 int gtk_font_options = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5513 int gtk_font_options_all = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5514 int max_scrollback_lines;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5515 int line_count;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5516 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
5517 gboolean show_date;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5518 char *mdate;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5519 char *str;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5520 char *with_font_tag;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5521 char *sml_attrib = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5522 size_t length;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5523 PurpleConversationType type;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5524 char *displaying;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5525 gboolean plugin_return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5526 char *bracket;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5527 int tag_count = 0;
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5528 gboolean is_rtl_message = FALSE;
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
5529
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5530 g_return_if_fail(conv != NULL);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5531 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5532 g_return_if_fail(gtkconv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5533
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
5534 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
5535 /* 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
5536 * 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
5537 * 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
5538 * 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
5539 */
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
5540 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
5541 }
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
5542
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5543 if (conv != gtkconv->active_conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5544 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5545 if (flags & PURPLE_MESSAGE_ACTIVE_ONLY)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5546 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5547 /* 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
5548 * 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
5549 * 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
5550 * purple_conversation_write(). */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5551 purple_debug_info("gtkconv",
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
5552 "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
5553 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5554 }
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 /* 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
5557 /* 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
5558 if (flags & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV))
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
5559 pidgin_conv_switch_active_conversation(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5560 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5561
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5562 type = purple_conversation_get_type(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5563 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5564 g_return_if_fail(account != NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5565 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
5566 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
5567
15579
74b945e7609c Moved linkification of incoming messages to pidgin_conv_write_conv()
Evan Schoenberg <evan.s@dreskin.net>
parents: 15560
diff changeset
5568 /* 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
5569 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
5570 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
5571 else
7790021b1270 add a PURPLE_MESSAGE_NO_LINKIFY to prevent things from getting linkified
Nathan Walp <nwalp@pidgin.im>
parents: 18024
diff changeset
5572 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
5573
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5574 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
5575 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
5576 "displaying-im-msg" : "displaying-chat-msg"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5577 account, name, &displaying, conv, flags));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5578 if (plugin_return)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5579 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5580 g_free(displaying);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5581 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5582 }
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5583 length = strlen(displaying) + 1;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5584
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5585 /* 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
5586 * 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
5587 * needs that much formatting, anyway.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5588 */
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5589 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
5590 tag_count++;
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5591
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5592 if (tag_count > 100) {
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5593 char *tmp = displaying;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5594 displaying = purple_markup_strip_html(tmp);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5595 g_free(tmp);
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5596 }
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5597
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5598 win = gtkconv->win;
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
5599 prpl_info = gc ? PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl) : NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5600
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5601 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
5602 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
5603 gtkconv->imhtml)));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5604
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5605 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
5606 PIDGIN_PREFS_ROOT "/conversations/scrollback_lines");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5607 /* 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
5608 max scrollback, trim down to max scrollback */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5609 if (max_scrollback_lines > 0
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5610 && line_count > (max_scrollback_lines + 100)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5611 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
5612 GTK_TEXT_VIEW(gtkconv->imhtml));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5613 GtkTextIter start, end;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5614
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5615 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
5616 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
5617 (line_count - max_scrollback_lines));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5618 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
5619 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5620
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5621 if (type == PURPLE_CONV_TYPE_CHAT)
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 /* Create anchor for user */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5624 GtkTextIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5625 char *tmp = g_strconcat("user:", name, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5626
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5627 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
5628 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
5629 tmp, &iter, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5630 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5631 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5632
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
5633 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
5634 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
5635
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5636 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
5637 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
5638
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
5639 /* 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
5640 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
5641 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
5642
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5643 /* 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
5644 * 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
5645 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
5646
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5647 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
5648 "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
5649 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
5650
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5651 if (mdate == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5652 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5653 struct tm *tm = localtime(&mtime);
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5654 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
5655 if (show_date)
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5656 tmp = purple_date_format_long(tm);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5657 else
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5658 tmp = purple_time_format(tm);
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5659 mdate = g_strdup_printf("(%s)", tmp);
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5660 }
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5661
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5662 /* Bi-Directional support - set timestamp direction using unicode characters */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5663 is_rtl_message = html_is_rtl(message);
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5664 /* Enforce direction only if message is RTL - doesn't effect LTR users */
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5665 if (is_rtl_message)
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5666 str_embed_direction_chars(&mdate);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5667
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
5668 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
5669 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
5670
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5671 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
5672
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5673 gtk_font_options |= GTK_IMHTML_NO_COMMENTS;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5674
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5675 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
5676 !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
5677 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
5678
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5679 /* 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
5680 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
5681 OPT_PROTO_USE_POINTSIZE) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5682 gtk_font_options |= GTK_IMHTML_USE_POINTSIZE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5683 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5684
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
5685 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
5686 {
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
5687 /* 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
5688 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
5689 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5690
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5691 /* 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
5692 if (flags & PURPLE_MESSAGE_RAW) {
15602
b03021cef5cb SF Patch #1653845 from Matt Perry
Richard Laager <rlaager@wiktel.com>
parents: 15579
diff changeset
5693 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
5694 } else if (flags & PURPLE_MESSAGE_SYSTEM) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5695 g_snprintf(buf2, sizeof(buf2),
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5696 "<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
5697 sml_attrib ? sml_attrib : "", mdate, displaying);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5698
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5699 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
5700
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5701 } else if (flags & PURPLE_MESSAGE_ERROR) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5702 g_snprintf(buf2, sizeof(buf2),
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5703 "<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
5704 sml_attrib ? sml_attrib : "", mdate, displaying);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5705
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5706 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
5707
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5708 } 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
5709 g_snprintf(buf2, BUF_LONG,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5710 "<B><FONT %s COLOR=\"#777777\">%s</FONT></B>",
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5711 sml_attrib ? sml_attrib : "", displaying);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5712
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5713 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
5714 } else {
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5715 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
5716 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
5717 /* The initial offset is to deal with
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5718 * 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
5719 int tag_start_offset = 0;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5720 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
5721 const char *tagname = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5722
23168
e01b5aa9fc7b Fix the offset for coloring nicknames, especially for auto-replies, and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23161
diff changeset
5723 GtkTextIter start, end;
23169
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
5724 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
5725 GtkTextTag *tag;
e01b5aa9fc7b Fix the offset for coloring nicknames, especially for auto-replies, and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23161
diff changeset
5726 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
5727
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5728 /* Enforce direction on alias */
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5729 if (is_rtl_message)
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5730 str_embed_direction_chars(&alias_escaped);
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5731
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
5732 str = g_malloc(1024);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5733 if (flags & PURPLE_MESSAGE_WHISPER) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5734 /* 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
5735 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
5736 g_snprintf(str, 1024, "***%s", alias_escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5737 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
5738 tagname = "whisper-action-name";
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5739 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5740 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5741 g_snprintf(str, 1024, "*%s*:", alias_escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5742 tag_start_offset += 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5743 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
5744 tagname = "whisper-name";
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5745 }
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
5746 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5747 if (purple_message_meify(new_message, -1)) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5748 if (flags & PURPLE_MESSAGE_AUTO_RESP) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5749 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
5750 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
5751 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5752 g_snprintf(str, 1024, "***%s", alias_escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5753 tag_start_offset += 3;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5754 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5755
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5756 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
5757 tagname = "highlight-name";
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5758 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
5759 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
5760 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5761 if (flags & PURPLE_MESSAGE_AUTO_RESP) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5762 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
5763 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
5764 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5765 g_snprintf(str, 1024, "%s:", alias_escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5766 tag_end_offset = 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5767 }
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
5768
21840
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5769 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
5770 tagname = "highlight-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
5771 } else if (flags & PURPLE_MESSAGE_RECV) {
23007
3c78771b520a Clarify a comment.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23005
diff changeset
5772 /* 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
5773 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
5774 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
5775 }
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
5776 } 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
5777 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
5778 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5779 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
5780 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5781 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5782 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5783
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5784 g_free(alias_escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5785
23168
e01b5aa9fc7b Fix the offset for coloring nicknames, especially for auto-replies, and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23161
diff changeset
5786 if (tagname)
e01b5aa9fc7b Fix the offset for coloring nicknames, especially for auto-replies, and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23161
diff changeset
5787 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
5788 else
e01b5aa9fc7b Fix the offset for coloring nicknames, especially for auto-replies, and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23161
diff changeset
5789 tag = get_buddy_tag(conv, name, TRUE);
e01b5aa9fc7b Fix the offset for coloring nicknames, especially for auto-replies, and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23161
diff changeset
5790
23169
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
5791 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
5792 /* 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
5793 * 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
5794 * 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
5795 * 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
5796 * this will have to do. I don't terribly like it. -- sadrul */
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
5797 GdkColor *color = NULL;
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
5798 gboolean set = FALSE;
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
5799 char colcode[] = "COLOR=\"#XXXXXX\"";
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
5800 g_object_get(G_OBJECT(tag), "foreground-set", &set, "foreground-gdk", &color, NULL);
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
5801 if (set && color)
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
5802 g_snprintf(colcode, sizeof(colcode), "COLOR=\"#%02x%02x%02x\"",
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
5803 color->red >> 8, color->green >> 8, color->blue >> 8);
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
5804 else
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
5805 colcode[0] = '\0';
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
5806 g_snprintf(buf2, BUF_LONG, "<FONT %s SIZE=\"2\"><!--%s --></FONT>", colcode, mdate);
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
5807 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
5808 if (color)
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
5809 gdk_color_free(color);
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
5810 }
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
5811
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
5812 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
5813 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
5814
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
5815 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
5816 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
5817
88d67b1bb52a Get rid of the boldness of the bold timestamps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23168
diff changeset
5818 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
5819 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
5820 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
5821 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
5822
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5823 g_free(str);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5824
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5825 if(gc){
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5826 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
5827 char *post = "</font>";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5828 int pre_len = strlen(pre);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5829 int post_len = strlen(post);
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 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
5832
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5833 strcpy(with_font_tag, pre);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5834 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
5835 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
5836
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5837 length += pre_len + post_len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5838 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
5839 } else
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5840 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
5841
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5842 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
5843 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
5844
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5845 g_free(with_font_tag);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5846 g_free(new_message);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5849 g_free(mdate);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5850 g_free(sml_attrib);
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 /* Tab highlighting stuff */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5853 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
5854 {
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
5855 PidginUnseenState unseen = PIDGIN_UNSEEN_NONE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5856
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5857 if ((flags & PURPLE_MESSAGE_NICK) == PURPLE_MESSAGE_NICK)
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
5858 unseen = PIDGIN_UNSEEN_NICK;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5859 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
5860 ((flags & PURPLE_MESSAGE_ERROR) == PURPLE_MESSAGE_ERROR))
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
5861 unseen = PIDGIN_UNSEEN_EVENT;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5862 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
5863 unseen = PIDGIN_UNSEEN_NO_LOG;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5864 else
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
5865 unseen = PIDGIN_UNSEEN_TEXT;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5866
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5867 gtkconv_set_unseen(gtkconv, unseen);
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
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
5870 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
5871 {
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
5872 /* 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
5873 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
5874 }
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
5875
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5876 purple_signal_emit(pidgin_conversations_get_handle(),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5877 (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
5878 account, name, displaying, conv, flags);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5879 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
5880 update_typing_message(gtkconv, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5881 }
19559
11849a5c3951 Update the chat topic and userlist when reattaching the Pidgin UI.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19556
diff changeset
5882
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5883 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5884 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
5885 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5886 PurpleConvChat *chat;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5887 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5888 PidginChatPane *gtkchat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5889 GtkListStore *ls;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5890 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5891
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5892 char tmp[BUF_LONG];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5893 int num_users;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5894
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5895 chat = PURPLE_CONV_CHAT(conv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5896 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5897 gtkchat = gtkconv->u.chat;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5898
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
5899 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
5900
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5901 g_snprintf(tmp, sizeof(tmp),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5902 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
5903 num_users),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5904 num_users);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5905
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5906 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
5907
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5908 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
5909
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5910 #if GTK_CHECK_VERSION(2,6,0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5911 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
5912 GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5913 #endif
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 l = cbuddies;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5916 while (l != NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5917 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
5918 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5919 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5920
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5921 /* 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
5922 * 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
5923 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5924 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
5925 GTK_SORT_ASCENDING);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5926 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5927
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5928 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5929 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
5930 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
5931 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5932 PurpleConvChat *chat;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5933 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5934 PidginChatPane *gtkchat;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5935 PurpleConvChatBuddyFlags flags;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5936 PurpleConvChatBuddy *cbuddy;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5937 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5938 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5939 int f = 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5940
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5941 chat = PURPLE_CONV_CHAT(conv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5942 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5943 gtkchat = gtkconv->u.chat;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5944
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5945 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
5946
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5947 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
5948 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5949
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5950 while (f != 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5951 char *val;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5952
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5953 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
5954
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5955 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
5956 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
5957 g_free(val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5958 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5959 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5960
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5961 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
5962
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5963 g_free(val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5964 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5965
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5966 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
5967 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5968
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5969 g_return_if_fail(new_alias != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5970
18305
ffd706ec0220 Set and use convchatbuddy->buddy.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18302
diff changeset
5971 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
5972
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5973 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
5974 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5975
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5976 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5977 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
5978 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5979 PurpleConvChat *chat;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5980 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5981 PidginChatPane *gtkchat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5982 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5983 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5984 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5985 char tmp[BUF_LONG];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5986 int num_users;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5987 gboolean f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5988
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5989 chat = PURPLE_CONV_CHAT(conv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5990 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5991 gtkchat = gtkconv->u.chat;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5992
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
5993 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
5994
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5995 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
5996 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
5997
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5998 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
5999 continue;
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 do {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6002 char *val;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6003
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6004 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
6005 CHAT_USERS_NAME_COLUMN, &val, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6006
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6007 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
6008 #if GTK_CHECK_VERSION(2,2,0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6009 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
6010 #else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6011 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
6012 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
6013 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6014 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6015 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6016 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
6017
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6018 g_free(val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6019 } while (f);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6020 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6021
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6022 g_snprintf(tmp, sizeof(tmp),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6023 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
6024 num_users), num_users);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6025
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6026 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
6027 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6028
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6029 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6030 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
6031 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6032 PurpleConvChat *chat;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6033 PurpleConvChatBuddyFlags flags;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6034 PurpleConvChatBuddy *cbuddy;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6035 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6036 PidginChatPane *gtkchat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6037 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6038 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6039 int f = 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6040 char *alias = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6041
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6042 chat = PURPLE_CONV_CHAT(conv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6043 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6044 gtkchat = gtkconv->u.chat;
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 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
6047
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6048 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
6049 return;
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 while (f != 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6052 char *val;
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 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
6055
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6056 if (!purple_utf8_strcasecmp(user, val)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6057 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
6058 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
6059 g_free(val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6060 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6061 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6062
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6063 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
6064
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6065 g_free(val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6066 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6067
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6068 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
6069 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6070 g_free(alias);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6071 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6072 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6073
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6074 g_return_if_fail(alias != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6075
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6076 flags = purple_conv_chat_user_get_flags(chat, user);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6077
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
6078 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
6079 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
6080 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
6081 g_free(alias);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6082 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6083
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6084 gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6085 pidgin_conv_has_focus(PurpleConversation *conv)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6086 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6087 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6088 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6089 gboolean has_focus;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6090
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6091 win = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6092
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6093 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
6094
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6095 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
6096 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6097
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6098 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6099 }
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 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6102 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
6103 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6104 GtkIMHtmlSmiley *smiley;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6105
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6106 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
6107
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6108 if (smiley) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6109 if (!(smiley->flags & GTK_IMHTML_SMILEY_CUSTOM)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6110 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6111 }
22889
019052a807a3 Introduce API for GtkIMHtmlSmiley. Use this to prevent leaking remote custom emoticons.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22885
diff changeset
6112 gtk_imhtml_smiley_reload(smiley);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6113 return TRUE;
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
22889
019052a807a3 Introduce API for GtkIMHtmlSmiley. Use this to prevent leaking remote custom emoticons.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22885
diff changeset
6116 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
6117 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
6118 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
6119
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6120 return TRUE;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6123 static gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6124 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
6125 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6126 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6127 struct smiley_list *list;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6128 const char *sml = NULL, *conv_sml;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6129
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6130 if (!conv || !smile || !*smile) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6131 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6132 }
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 /* 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
6135 if (pidgin_themes_smileys_disabled())
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6136 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6137
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6138 /* 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
6139 * 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
6140 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
6141 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6142
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6143 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
6144 if (!strcmp(list->sml, conv_sml)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6145 sml = list->sml;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6146 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6147 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6148 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6149
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6150 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
6151 return FALSE;
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 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
6154 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
6155 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6156
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6157 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6158 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6159
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6160 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6161 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
6162 const guchar *data, gsize size)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6163 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6164 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6165 GtkIMHtmlSmiley *smiley;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6166 GdkPixbufLoader *loader;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6167 const char *sml;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6168
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6169 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
6170 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6171 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
6172
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6173 if (!smiley)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6174 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6175
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6176 loader = smiley->loader;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6177 if (!loader)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6178 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6179
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6180 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
6181 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6182
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6183 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6184 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
6185 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6186 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6187 GtkIMHtmlSmiley *smiley;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6188 GdkPixbufLoader *loader;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6189 const char *sml;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6190
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6191 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6192 g_return_if_fail(smile != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6193
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6194 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
6195 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6196 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
6197
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6198 if (!smiley)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6199 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6200
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6201 loader = smiley->loader;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6202
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6203 if (!loader)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6204 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6205
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6206
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6207
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6208 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
6209
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6210 gdk_pixbuf_loader_close(loader, NULL);
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6213
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6214 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6215 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
6216 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6217 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6218
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6219 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
6220 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6221
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6222 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6223 * 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
6224 * 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
6225 * account signs on or off.
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 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6228 gray_stuff_out(PidginConversation *gtkconv)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6229 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6230 PidginWindow *win;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6231 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6232 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6233 PurplePluginProtocolInfo *prpl_info = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6234 GdkPixbuf *window_icon = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6235 GtkIMHtmlButtons buttons;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6236 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6237
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6238 win = pidgin_conv_get_window(gtkconv);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6239 gc = purple_conversation_get_gc(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6240 account = purple_conversation_get_account(conv);
15374
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 if (gc != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6243 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
6244
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6245 if (win->menu.send_to != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6246 update_send_to_selection(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6247
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6248 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6249 * 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
6250 * 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
6251 * 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
6252 * 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
6253 * 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
6254 * is sensitive or not.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6255 */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6256 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
6257 /* 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
6258
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6259 /* Deal with menu items */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6260 gtk_widget_show(win->menu.view_log);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6261 gtk_widget_show(win->menu.send_file);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6262 gtk_widget_show(win->menu.add_pounce);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6263 gtk_widget_show(win->menu.get_info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6264 gtk_widget_hide(win->menu.invite);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6265 gtk_widget_show(win->menu.alias);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6266 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
6267 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
6268 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
6269 } 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
6270 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
6271 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
6272 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6273
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6274 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
6275 gtk_widget_show(win->menu.add);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6276 gtk_widget_hide(win->menu.remove);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6277 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6278 gtk_widget_show(win->menu.remove);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6279 gtk_widget_hide(win->menu.add);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6280 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6281
17776
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
6282 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
6283 gtk_widget_show(win->menu.insert_image);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6284 } 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
6285 /* 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
6286
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6287 /* Deal with menu items */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6288 gtk_widget_show(win->menu.view_log);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6289 gtk_widget_hide(win->menu.send_file);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6290 gtk_widget_hide(win->menu.add_pounce);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6291 gtk_widget_hide(win->menu.get_info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6292 gtk_widget_show(win->menu.invite);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6293 gtk_widget_show(win->menu.alias);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6294 gtk_widget_hide(win->menu.block);
15555
883bf81c8d73 Hide the unblock menuitem for chats.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15465
diff changeset
6295 gtk_widget_hide(win->menu.unblock);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6296
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6297 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
6298 /* 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
6299 gtk_widget_show(win->menu.add);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6300 gtk_widget_hide(win->menu.remove);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6301 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6302 /* 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
6303 gtk_widget_hide(win->menu.add);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6304 gtk_widget_show(win->menu.remove);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6305 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6306
17776
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
6307 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
6308 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
6309 }
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 * 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
6313 * and what features that account supports.
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 if ((gc != NULL) &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6316 ((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
6317 !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
6318 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6319 /* Account is online */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6320 /* Deal with the toolbar */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6321 if (conv->features & PURPLE_CONNECTION_HTML)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6322 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6323 buttons = GTK_IMHTML_ALL; /* Everything on */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6324 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
6325 buttons &= ~GTK_IMHTML_BACKCOLOR;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6326 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
6327 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6328 buttons &= ~GTK_IMHTML_GROW;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6329 buttons &= ~GTK_IMHTML_SHRINK;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6330 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6331 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
6332 buttons &= ~GTK_IMHTML_LINKDESC;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6333 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6334 buttons = GTK_IMHTML_SMILEY | GTK_IMHTML_IMAGE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6335 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6336
18167
b8b475f31008 Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <stu@nosnilmot.com>
parents: 18121
diff changeset
6337 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
6338 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
6339
b8b475f31008 Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <stu@nosnilmot.com>
parents: 18121
diff changeset
6340 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
6341 buttons &= ~GTK_IMHTML_IMAGE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6342
23133
9aa105267f46 Show the custom smileys only on accounts that support it. References
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23131
diff changeset
6343 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
6344 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
6345 else
9aa105267f46 Show the custom smileys only on accounts that support it. References
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23131
diff changeset
6346 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
6347
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6348 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
6349 if (account != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6350 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
6351
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6352 /* Deal with menu items */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6353 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
6354 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
6355 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
6356 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
6357 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
6358 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
6359
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6360 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
6361 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6362 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
6363 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
6364 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
6365 (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
6366 prpl_info->can_receive_file(gc, purple_conversation_get_name(conv)))));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6367 gtk_widget_set_sensitive(win->menu.alias,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6368 (account != NULL) &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6369 (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
6370 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6371 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
6372 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6373 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
6374 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
6375 gtk_widget_set_sensitive(win->menu.alias,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6376 (account != NULL) &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6377 (purple_blist_find_chat(account, purple_conversation_get_name(conv)) != NULL));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6378 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6379
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6380 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6381 /* Account is offline */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6382 /* 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
6383
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6384 /* Then deal with menu items */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6385 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
6386 gtk_widget_set_sensitive(win->menu.send_file, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6387 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
6388 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
6389 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
6390 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
6391 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
6392 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
6393 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
6394 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
6395 }
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 * Update the window's icon
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6399 */
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6400 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
6401 {
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
6402 GList *l = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6403 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
6404 (gtkconv->u.im->anim))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6405 {
20183
dd4c3d712835 applied changes from 9d5a2f820265e4631d68d0f12a2def66acf36e3d
Richard Laager <rlaager@wiktel.com>
parents: 20028
diff changeset
6406 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
6407 window_icon =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6408 gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim);
20183
dd4c3d712835 applied changes from 9d5a2f820265e4631d68d0f12a2def66acf36e3d
Richard Laager <rlaager@wiktel.com>
parents: 20028
diff changeset
6409
dd4c3d712835 applied changes from 9d5a2f820265e4631d68d0f12a2def66acf36e3d
Richard Laager <rlaager@wiktel.com>
parents: 20028
diff changeset
6410 if (buddy && !PURPLE_BUDDY_IS_ONLINE(buddy))
dd4c3d712835 applied changes from 9d5a2f820265e4631d68d0f12a2def66acf36e3d
Richard Laager <rlaager@wiktel.com>
parents: 20028
diff changeset
6411 gdk_pixbuf_saturate_and_pixelate(window_icon, window_icon, 0.0, FALSE);
dd4c3d712835 applied changes from 9d5a2f820265e4631d68d0f12a2def66acf36e3d
Richard Laager <rlaager@wiktel.com>
parents: 20028
diff changeset
6412
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6413 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
6414 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
6415 } 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
6416 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
6417 }
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
6418 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
6419 if (window_icon != NULL) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6420 g_object_unref(G_OBJECT(window_icon));
15749
74923b83e042 Fix a small leak
Sean Egan <seanegan@gmail.com>
parents: 15748
diff changeset
6421 g_list_free(l);
74923b83e042 Fix a small leak
Sean Egan <seanegan@gmail.com>
parents: 15748
diff changeset
6422 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6423 }
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6426 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6427 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
6428 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6429 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6430 PidginWindow *win;
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 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6433 if (!gtkconv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6434 return;
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6435 win = pidgin_conv_get_window(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6436 if (!win)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6437 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6438
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6439 if (fields & PIDGIN_CONV_SET_TITLE)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6440 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6441 purple_conversation_autoset_title(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6442 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6443
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6444 if (fields & PIDGIN_CONV_BUDDY_ICON)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6445 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6446 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
6447 pidgin_conv_update_buddy_icon(conv);
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6448 }
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6449
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6450 if (fields & PIDGIN_CONV_MENU)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6451 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6452 gray_stuff_out(PIDGIN_CONVERSATION(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6453 generate_send_to_items(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6454 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6455
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6456 if (fields & PIDGIN_CONV_TAB_ICON)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6457 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6458 update_tab_icon(conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6459 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
6460 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6461
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6462 if ((fields & PIDGIN_CONV_TOPIC) &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6463 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
6464 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6465 const char *topic;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6466 PurpleConvChat *chat = PURPLE_CONV_CHAT(conv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6467 PidginChatPane *gtkchat = gtkconv->u.chat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6468
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6469 if (gtkchat->topic_text != NULL)
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 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
6472
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6473 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
6474 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
6475 topic ? topic : "", NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6476 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6477 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6478
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6479 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
6480 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
6481
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6482 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
6483 (fields & PIDGIN_CONV_SET_TITLE) ||
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6484 (fields & PIDGIN_CONV_TOPIC))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6485 {
19291
c003aa584909 Remove truncation until we can do it smarter
Sean Egan <seanegan@gmail.com>
parents: 19290
diff changeset
6486 char *title;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6487 PurpleConvIm *im = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6488 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
6489 PurpleBuddy *buddy = NULL;
450a3dae477a Experimental tab-space-saving experiments. use text formatting instead of icons to represent status. Truncate buddy's names at a space or at-sign to make tabs more readable.
Sean Egan <seanegan@gmail.com>
parents: 18781
diff changeset
6490 PurplePresence *p = NULL;
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6491 char *markup = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6492 AtkObject *accessibility_obj;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6493 /* 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
6494 char *style;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6495
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6496 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
6497 im = PURPLE_CONV_IM(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6498
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6499 if ((account == NULL) ||
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6500 !purple_account_is_connected(account) ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6501 ((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
6502 && 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
6503 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
6504 else
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6505 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
6506
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6507 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
6508 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
6509 if (buddy) {
450a3dae477a Experimental tab-space-saving experiments. use text formatting instead of icons to represent status. Truncate buddy's names at a space or at-sign to make tabs more readable.
Sean Egan <seanegan@gmail.com>
parents: 18781
diff changeset
6510 p = purple_buddy_get_presence(buddy);
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6511 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
6512 } else {
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6513 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
6514 }
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6515 } 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
6516 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
6517 ? 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
6518 : NULL;
22435
5c72a6c071db Escape conversation title for use in infopane so that ampersands don't
Stu Tomlinson <stu@nosnilmot.com>
parents: 22422
diff changeset
6519 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
6520 #if GTK_CHECK_VERSION(2,6,0)
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6521 esc = topic ? g_markup_escape_text(topic, -1) : NULL;
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6522 #else
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6523 /* GTK < 2.6 doesn't have auto ellipsization, so we do a crude
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6524 * trucation to prevent forcing the window to be as wide as the topic */
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6525 int len = 0;
22435
5c72a6c071db Escape conversation title for use in infopane so that ampersands don't
Stu Tomlinson <stu@nosnilmot.com>
parents: 22422
diff changeset
6526 char *c;
5c72a6c071db Escape conversation title for use in infopane so that ampersands don't
Stu Tomlinson <stu@nosnilmot.com>
parents: 22422
diff changeset
6527
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
6528 if (topic != NULL) {
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
6529 tmp = g_strdup(topic);
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
6530 c = tmp;
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
6531 while(*c && len < 72) {
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
6532 c = g_utf8_next_char(c);
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
6533 len++;
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
6534 }
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
6535 if (len == 72) {
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
6536 *c = '\0';
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
6537 c = g_strdup_printf("%s...", tmp);
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
6538 g_free(tmp);
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
6539 tmp = c;
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
6540 }
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
6541 esc = g_markup_escape_text(tmp, -1);
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
6542 g_free(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
6543 }
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6544 #endif
22435
5c72a6c071db Escape conversation title for use in infopane so that ampersands don't
Stu Tomlinson <stu@nosnilmot.com>
parents: 22422
diff changeset
6545 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
6546 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
6547 tmp, esc && *esc ? "\n" : "",
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6548 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
6549 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
6550 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
6551 g_free(esc);
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6552 }
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
6553 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
6554 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
6555 /* 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
6556 gtk_widget_queue_draw(gtkconv->infopane);
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6557
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
6558 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
6559 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
6560
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6561 if (!GTK_WIDGET_REALIZED(gtkconv->tab_label))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6562 gtk_widget_realize(gtkconv->tab_label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6563
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6564 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
6565 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
6566 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
6567 atk_object_set_description(accessibility_obj, _("Typing"));
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6568 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
6569 } 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
6570 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
6571 atk_object_set_description(accessibility_obj, _("Stopped Typing"));
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6572 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
6573 } 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
6574 atk_object_set_description(accessibility_obj, _("Nick Said"));
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6575 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
6576 } 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
6577 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
6578 if (gtkconv->active_conv->type == PURPLE_CONV_TYPE_CHAT)
21704
a4b36b22ea94 New style.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21703
diff changeset
6579 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
6580 else
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6581 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
6582 } 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
6583 atk_object_set_description(accessibility_obj, _("New Event"));
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6584 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
6585 } 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
6586 style = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6587 }
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
6588
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6589 gtk_widget_set_name(gtkconv->tab_label, style);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6590 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
6591 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
6592
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
6593 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
6594 gtkconv->unseen_state == PIDGIN_UNSEEN_NICK ||
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6595 gtkconv->unseen_state == PIDGIN_UNSEEN_EVENT) {
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6596 PangoAttrList *list = pango_attr_list_new();
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6597 PangoAttribute *attr = pango_attr_weight_new(PANGO_WEIGHT_BOLD);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6598 attr->start_index = 0;
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6599 attr->end_index = -1;
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6600 pango_attr_list_insert(list, attr);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6601 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
6602 pango_attr_list_unref(list);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6603 } else
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6604 gtk_label_set_attributes(GTK_LABEL(gtkconv->tab_label), NULL);
22038
13d290879e0a shorted the 'typing then stopped' message
Sean Egan <seanegan@gmail.com>
parents: 22037
diff changeset
6605
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6606 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
6607 update_typing_icon(gtkconv);
22038
13d290879e0a shorted the 'typing then stopped' message
Sean Egan <seanegan@gmail.com>
parents: 22037
diff changeset
6608
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6609 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
6610 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
6611 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
6612 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
6613 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
6614 }
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 g_free(title);
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6619
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6620 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6621 pidgin_conv_updated(PurpleConversation *conv, PurpleConvUpdateType type)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6622 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6623 PidginConvFields flags = 0;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6624
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6625 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6626
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6627 if (type == PURPLE_CONV_UPDATE_ACCOUNT)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6628 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6629 flags = PIDGIN_CONV_ALL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6630 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6631 else if (type == PURPLE_CONV_UPDATE_TYPING ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6632 type == PURPLE_CONV_UPDATE_UNSEEN ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6633 type == PURPLE_CONV_UPDATE_TITLE)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6634 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6635 flags = PIDGIN_CONV_COLORIZE_TITLE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6636 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6637 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
6638 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6639 flags = PIDGIN_CONV_TOPIC;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6640 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6641 else if (type == PURPLE_CONV_ACCOUNT_ONLINE ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6642 type == PURPLE_CONV_ACCOUNT_OFFLINE)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6643 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6644 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
6645 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6646 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
6647 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6648 flags = PIDGIN_CONV_TAB_ICON;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6649 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6650 else if (type == PURPLE_CONV_UPDATE_ADD ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6651 type == PURPLE_CONV_UPDATE_REMOVE ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6652 type == PURPLE_CONV_UPDATE_CHATLEFT)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6653 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6654 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
6655 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6656 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
6657 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6658 flags = PIDGIN_CONV_BUDDY_ICON;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6659 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6660 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
6661 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6662 flags = PIDGIN_CONV_MENU;
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6663 }
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6664
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6665 pidgin_conv_update_fields(conv, flags);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6666 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6667
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
6668 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
6669 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
6670 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
6671 {
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
6672 if (conv == NULL || PIDGIN_IS_PIDGIN_CONVERSATION(conv))
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
6673 return;
20953
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
6674 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
6675 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
6676
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
6677 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
6678 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
6679 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
6680 ((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
6681 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
6682 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
6683 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
6684 else
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
6685 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
6686
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
6687 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
6688 }
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
6689 }
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
6690
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6691 static PurpleConversationUiOps conversation_ui_ops =
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6692 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6693 pidgin_conv_new,
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6694 pidgin_conv_destroy, /* destroy_conversation */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6695 NULL, /* write_chat */
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6696 pidgin_conv_write_im, /* write_im */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6697 pidgin_conv_write_conv, /* write_conv */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6698 pidgin_conv_chat_add_users, /* chat_add_users */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6699 pidgin_conv_chat_rename_user, /* chat_rename_user */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6700 pidgin_conv_chat_remove_users, /* chat_remove_users */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6701 pidgin_conv_chat_update_user, /* chat_update_user */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6702 pidgin_conv_present_conversation, /* present */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6703 pidgin_conv_has_focus, /* has_focus */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6704 pidgin_conv_custom_smiley_add, /* custom_smiley_add */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6705 pidgin_conv_custom_smiley_write, /* custom_smiley_write */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6706 pidgin_conv_custom_smiley_close, /* custom_smiley_close */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6707 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
6708 NULL,
fbf111436896 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16604
diff changeset
6709 NULL,
fbf111436896 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16604
diff changeset
6710 NULL,
fbf111436896 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16604
diff changeset
6711 NULL
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6712 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6713
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6714 PurpleConversationUiOps *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6715 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
6716 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6717 return &conversation_ui_ops;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6718 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6719
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6720 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6721 * Public conversation utility functions
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6722 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6723 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6724 pidgin_conv_update_buddy_icon(PurpleConversation *conv)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6725 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6726 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6727 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6728
16381
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6729 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
6730
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6731 GdkPixbufLoader *loader;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6732 GdkPixbufAnimation *anim;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6733 GError *err = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6734
16381
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6735 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
6736 gconstpointer data = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6737 size_t len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6738
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6739 GdkPixbuf *buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6740
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6741 GtkWidget *event;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6742 GdkPixbuf *scale;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6743 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
6744 int size = 0;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6745
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6746 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6747 PurplePluginProtocolInfo *prpl_info = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6748
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6749 PurpleBuddyIcon *icon;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6750
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6751 g_return_if_fail(conv != NULL);
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
6752 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
6753 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
6754
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6755 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6756 win = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6757 if (conv != gtkconv->active_conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6758 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6759
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6760 if (!gtkconv->u.im->show_icon)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6761 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6762
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6763 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6764 if(account && account->gc)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6765 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(account->gc->prpl);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6766
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6767 /* Remove the current icon stuff */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6768 if (gtkconv->u.im->icon_container != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6769 gtk_widget_destroy(gtkconv->u.im->icon_container);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6770 gtkconv->u.im->icon_container = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6771
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6772 if (gtkconv->u.im->anim != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6773 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
6774
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6775 gtkconv->u.im->anim = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6776
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6777 if (gtkconv->u.im->icon_timer != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6778 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
6779
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6780 gtkconv->u.im->icon_timer = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6781
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6782 if (gtkconv->u.im->iter != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6783 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
6784
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6785 gtkconv->u.im->iter = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6786
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
6787 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
6788 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6789
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6790 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
6791 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6792
16381
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6793 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
6794 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
6795 {
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6796 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
6797 if (contact) {
23123
0ca259d5f928 Compile and de-warn.
Etan Reisner <pidgin@unreliablesource.net>
parents: 23122
diff changeset
6798 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
6799 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
6800 /* 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
6801 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
6802 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
6803 }
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6804 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6805 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6806
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6807 if (data == NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6808 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
6809
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6810 if (icon == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6811 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6812
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6813 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
6814
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6815 if (data == NULL)
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6816 return;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6817 }
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 loader = gdk_pixbuf_loader_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6820 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
6821 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
6822
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
6823 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
6824
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6825 anim = gdk_pixbuf_loader_get_animation(loader);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6826 if (anim)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6827 g_object_ref(G_OBJECT(anim));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6828 g_object_unref(loader);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6829
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6830 if (!anim)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6831 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6832 gtkconv->u.im->anim = anim;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6833
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6834 if (err) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6835 purple_debug(PURPLE_DEBUG_ERROR, "gtkconv",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6836 "Buddy icon error: %s\n", err->message);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6837 g_error_free(err);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6838 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6839
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6840 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
6841 GdkPixbuf *stat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6842 gtkconv->u.im->iter = NULL;
18213
270e87f5cde0 Round the other icons too
Sean Egan <seanegan@gmail.com>
parents: 18212
diff changeset
6843 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
6844 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
6845 } else {
18213
270e87f5cde0 Round the other icons too
Sean Egan <seanegan@gmail.com>
parents: 18212
diff changeset
6846 GdkPixbuf *stat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6847 gtkconv->u.im->iter =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6848 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
6849 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
6850 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
6851 if (gtkconv->u.im->animate)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6852 start_anim(NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6853 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6854
18214
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
6855 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
6856 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
6857
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
6858 gtk_widget_get_size_request(gtkconv->infopane_hbox, NULL, &size);
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
6859 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
6860
4040c4ee1f44 Clicking on the buddyicon in the conversation window toggles the size of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22732
diff changeset
6861 /* 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
6862 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
6863 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
6864 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
6865 } 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
6866 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
6867 scale_height = size;
18214
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
6868 } 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
6869 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
6870 scale_width = size;
18214
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
6871 }
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
6872 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
6873 GDK_INTERP_BILINEAR);
18213
270e87f5cde0 Round the other icons too
Sean Egan <seanegan@gmail.com>
parents: 18212
diff changeset
6874 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
6875 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
6876 pidgin_gdk_pixbuf_make_round(scale);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6877 gtkconv->u.im->icon_container = gtk_vbox_new(FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6878
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6879 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
6880 gtk_container_add(GTK_CONTAINER(gtkconv->u.im->icon_container), event);
20286
0ce367508ab6 Fix for compiling with Gtk < 2.4, references #3144
Stu Tomlinson <stu@nosnilmot.com>
parents: 20251
diff changeset
6881 #if GTK_CHECK_VERSION(2,4,0)
18821
0765cf9331f6 warning fixes
Sean Egan <seanegan@gmail.com>
parents: 18820
diff changeset
6882 gtk_event_box_set_visible_window(GTK_EVENT_BOX(event), FALSE);
20286
0ce367508ab6 Fix for compiling with Gtk < 2.4, references #3144
Stu Tomlinson <stu@nosnilmot.com>
parents: 20251
diff changeset
6883 #endif
18781
8b0663abb488 add tooltip to buddy icon in conversation too
Sean Egan <seanegan@gmail.com>
parents: 18779
diff changeset
6884 gtk_widget_add_events(event,
8b0663abb488 add tooltip to buddy icon in conversation too
Sean Egan <seanegan@gmail.com>
parents: 18779
diff changeset
6885 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
6886 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
6887 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
6888
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
6889 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
6890 gtk_widget_show(event);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6891
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6892 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
6893 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
6894 gtk_widget_show(gtkconv->u.im->icon);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6895
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6896 g_object_unref(G_OBJECT(scale));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6897
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
6898 gtk_box_pack_start(GTK_BOX(gtkconv->infopane_hbox),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6899 gtkconv->u.im->icon_container, FALSE, FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6900
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6901 gtk_widget_show(gtkconv->u.im->icon_container);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6902
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6903 /* 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
6904 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
6905 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6906 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
6907 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
6908 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
6909 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
6910 }
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6913 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6914 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
6915 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6916 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6917
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
6918 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6919 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6920
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6921 win = PIDGIN_CONVERSATION(conv)->win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6922
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6923 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
6924 gray_stuff_out(PIDGIN_CONVERSATION(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6925 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6926
22193
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
6927 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
6928 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
6929 {
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
6930 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
6931 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
6932
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
6933 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
6934 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
6935 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
6936 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
6937 }
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
6938
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6939 int
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6940 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
6941 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6942 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
6943 GtkNotebook *notebook;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6944 GtkWidget *page, *tab;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6945 gint i, page_num = -1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6946 gint count;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6947 gboolean horiz;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6948
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6949 if (to_right)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6950 *to_right = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6951
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6952 notebook = GTK_NOTEBOOK(win->notebook);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6953
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6954 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
6955 x_rel = x - nb_x;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6956 y_rel = y - nb_y;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6957
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6958 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
6959 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
6960
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6961 #if GTK_CHECK_VERSION(2,2,0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6962 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
6963 #else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6964 /* this is hacky, but it's only for Gtk 2.0.0... */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6965 count = g_list_length(GTK_NOTEBOOK(notebook)->children);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6966 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6967
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6968 for (i = 0; i < count; i++) {
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 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
6971 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
6972
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6973 /* 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
6974 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
6975 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6976
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6977 if (horiz) {
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
6978 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
6979 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
6980 page_num = i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6981
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6982 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
6983 *to_right = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6984
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6985 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6986 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6987 } else {
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
6988 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
6989 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
6990 page_num = i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6991
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6992 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
6993 *to_right = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6994
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6995 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6996 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6997 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6998 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6999
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7000 if (page_num == -1) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7001 /* Add after the last tab */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7002 page_num = count - 1;
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 return page_num;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7006 }
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 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7009 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
7010 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7011 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
7012 GList *l;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7013 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7014 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7015
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7016 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
7017 conv = (PurpleConversation *)l->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7018
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
7019 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7020 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7021
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7022 gtkconv = PIDGIN_CONVERSATION(conv);
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 if (value)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7025 gtk_widget_show(gtkconv->close);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7026 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7027 gtk_widget_hide(gtkconv->close);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7028 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7029 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7030
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7031 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7032 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
7033 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7034 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7035 #ifdef USE_GTKSPELL
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
7036 GList *cl;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7037 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7038 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7039 GtkSpell *spell;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7040
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7041 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
7042
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7043 conv = (PurpleConversation *)cl->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7044
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
7045 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7046 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7047
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7048 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7049
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7050 if (value)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7051 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
7052 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7053 spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(gtkconv->entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7054 gtkspell_detach(spell);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7055 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7056 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7057 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7058 }
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 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7061 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
7062 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7063 {
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
7064 GList *gtkwins, *gtkconvs;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7065 GtkPositionType pos;
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
7066 PidginWindow *gtkwin;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7067
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7068 pos = GPOINTER_TO_INT(value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7069
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
7070 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
7071 gtkwin = gtkwins->data;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
7072 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
7073 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
7074 pidgin_conv_tab_pack(gtkwin, gtkconvs->data);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
7075 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7076 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7077 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7078
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7079 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7080 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
7081 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7082 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
7083 GList *l;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7084 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7085 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7086 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7087
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7088 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
7089 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7090 conv = (PurpleConversation *)l->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7091
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
7092 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7093 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7094
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7095 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7096 win = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7097
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7098 gtk_check_menu_item_set_active(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7099 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
7100 (gboolean)GPOINTER_TO_INT(value));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7101
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7102 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
7103 (gboolean)GPOINTER_TO_INT(value));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7104 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7105 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7106
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7107 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7108 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
7109 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7110 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
7111 GList *l;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7112 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7113 PidginConversation *gtkconv;
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
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7116 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
7117 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7118 conv = (PurpleConversation *)l->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7119
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
7120 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7121 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7122
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7123 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7124 win = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7125
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7126 gtk_check_menu_item_set_active(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7127 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
7128 (gboolean)GPOINTER_TO_INT(value));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7129
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7130 if ((gboolean)GPOINTER_TO_INT(value))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7131 gtk_widget_show(gtkconv->toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7132 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7133 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
7134
21665
baa25b613999 Clean up warnings
Sean Egan <seanegan@gmail.com>
parents: 21664
diff changeset
7135 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
7136 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7137 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7138
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7139 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7140 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
7141 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7142 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
7143 GList *l;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7144 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7145 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7146 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7147
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7148 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
7149 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7150
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7151 /* 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
7152 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
7153 conv = (PurpleConversation *)l->data;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7154 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
7155 if (gtkconv)
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
7156 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
7157 }
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 /* 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
7160 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
7161 win = l->data;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7162 conv = pidgin_conv_window_get_active_conversation(win);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7163 pidgin_conv_update_buddy_icon(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7164 }
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7167 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7168 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
7169 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7170 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
7171 GList *l;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7172
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7173 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
7174 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
7175 if (!PIDGIN_CONVERSATION(conv))
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
7176 continue;
18602
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7177 if (GPOINTER_TO_INT(value))
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7178 gtk_widget_show(PIDGIN_CONVERSATION(conv)->infopane_hbox);
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7179 else
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7180 gtk_widget_hide(PIDGIN_CONVERSATION(conv)->infopane_hbox);
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7181
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7182 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
7183 pidgin_conv_update_buddy_icon(conv);
18602
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7184 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7185 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7186 }
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 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
7189 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
7190 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
7191 {
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
7192 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
7193 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
7194 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
7195 if (PIDGIN_CONVERSATION(conv))
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
7196 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
7197 }
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
7198 }
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
7199
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
7200 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7201 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
7202 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7203 {
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7204 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
7205 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7206
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7207 static void
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7208 account_status_changed_cb(PurpleAccount *account, PurpleStatus *oldstatus,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7209 PurpleStatus *newstatus)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7210 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7211 GList *l;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7212 PurpleConversation *conv = NULL;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7213 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7214
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7215 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
7216 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7217
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7218 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
7219 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7220
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7221 while ((l = hidden_convwin->gtkconvs) != NULL)
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 gtkconv = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7224
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7225 conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7226
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7227 while(l && !purple_status_is_available(
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7228 purple_account_get_active_status(
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7229 purple_conversation_get_account(conv))))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7230 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7231 if (!l)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7232 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7233
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7234 pidgin_conv_window_remove_gtkconv(hidden_convwin, gtkconv);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7235 pidgin_conv_placement_place(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7236
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7237 /* 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
7238 * 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
7239 purple_conversation_update(conv, PURPLE_CONV_UPDATE_UNSEEN);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7240 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7241 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7242
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7243 static void
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7244 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
7245 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7246 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7247 GList *l;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7248 PurpleConversation *conv = NULL;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7249 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7250 gboolean when_away = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7251
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7252 if(!hidden_convwin)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7253 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7254
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7255 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
7256 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7257
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7258 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
7259 when_away = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7260
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
7261 for (l = hidden_convwin->gtkconvs; l; )
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7262 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7263 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
7264 l = l->next;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7265
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7266 conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7267
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
7268 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
7269 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
7270 (when_away && !purple_status_is_available(
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7271 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
7272 purple_conversation_get_account(conv)))))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7273 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7274
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7275 pidgin_conv_window_remove_gtkconv(hidden_convwin, gtkconv);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7276 pidgin_conv_placement_place(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7277 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7278 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7279
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7280
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7281 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7282 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
7283 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7284 {
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
7285 PidginConvPlacementFunc func;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7286
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7287 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
7288 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7289
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7290 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
7291
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7292 if (func == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7293 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7294
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7295 pidgin_conv_placement_set_current_func(func);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7296 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7297
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7298 static PidginConversation *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7299 get_gtkconv_with_contact(PurpleContact *contact)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7300 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7301 PurpleBlistNode *node;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7302
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7303 node = ((PurpleBlistNode*)contact)->child;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7304
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7305 for (; node; node = node->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7306 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7307 PurpleBuddy *buddy = (PurpleBuddy*)node;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7308 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7309 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
7310 if (conv)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7311 return PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7312 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7313 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7314 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7315
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7316 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7317 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
7318 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
7319 GList *iter;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7320
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7321 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
7322 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7323 PurpleConversation *conv = iter->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7324
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7325 /* 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
7326 * 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
7327 * 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
7328 * 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
7329 /* if (purple_conversation_get_account(conv) == account) */
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7330 pidgin_conv_update_fields(conv, PIDGIN_CONV_TAB_ICON |
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7331 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
7332
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7333 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
7334 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
7335 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
7336 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
7337 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
7338 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
7339 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
7340 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
7341 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
7342 } else {
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7343 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
7344 }
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7345 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
7346 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
7347 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
7348 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7349 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7350 }
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 static gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7353 update_buddy_status_timeout(PurpleBuddy *buddy)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7354 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7355 /* 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
7356 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7357
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7358 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
7359 if (conv)
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7360 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
7361
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7362 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7363 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7364
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7365 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7366 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
7367 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7368 PidginConversation *gtkconv;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7369 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7370
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7371 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
7372 if (gtkconv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7373 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7374 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
7375 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
7376 | 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
7377 | PIDGIN_CONV_BUDDY_ICON);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7378 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
7379 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
7380 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7381
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7382 /* In case a conversation is started after the buddy has signed-on/off */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7383 g_timeout_add(11000, (GSourceFunc)update_buddy_status_timeout, buddy);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7384 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7385
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7386 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7387 update_buddy_privacy_changed(PurpleBuddy *buddy)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7388 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7389 PidginConversation *gtkconv;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7390 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7391
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7392 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
7393 if (gtkconv) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7394 conv = gtkconv->active_conv;
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7395 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
7396 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7397 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7398
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7399 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7400 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
7401 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7402 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7403
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7404 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
7405 if (conv)
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7406 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
7407 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7408
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7409 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7410 update_buddy_icon(PurpleBuddy *buddy)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7411 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7412 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7413
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7414 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
7415 if (conv)
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7416 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
7417 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7418
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7419 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7420 update_buddy_sign(PurpleBuddy *buddy, const char *which)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7421 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7422 PurplePresence *presence;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7423 PurpleStatus *on, *off;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7424
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7425 presence = purple_buddy_get_presence(buddy);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7426 if (!presence)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7427 return;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7428 off = purple_presence_get_status(presence, "offline");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7429 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
7430
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7431 if (*(which+1) == 'f')
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7432 update_buddy_status_changed(buddy, on, off);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7433 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7434 update_buddy_status_changed(buddy, off, on);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7435 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7436
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7437 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7438 update_conversation_switched(PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7439 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7440 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
7441 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
7442 }
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 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7445 update_buddy_typing(PurpleAccount *account, const char *who)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7446 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7447 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7448 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7449
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7450 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
7451 if (!conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7452 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7453
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7454 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7455 if (gtkconv && gtkconv->active_conv == conv)
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7456 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
7457 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7458
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7459 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7460 update_chat(PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7461 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7462 pidgin_conv_update_fields(conv, PIDGIN_CONV_TOPIC |
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7463 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
7464 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7465
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7466 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7467 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
7468 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7469 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
7470 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7471
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7472 /* Message history stuff */
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7473
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7474 /* 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
7475 static int
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7476 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
7477 {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7478 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
7479 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
7480 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7481
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7482 /* 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
7483 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
7484 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
7485 {
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7486 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
7487 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
7488 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
7489 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
7490 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
7491
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
7492 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
7493 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
7494 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
7495 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
7496 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
7497 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
7498 }
21263
1812b8ccfd7a Show alias in restored conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21244
diff changeset
7499 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
7500 if (im) {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7501 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
7502 } else {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7503 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
7504 }
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
7505 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
7506 }
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7507 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
7508 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
7509 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
7510
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7511 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
7512 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
7513 if (im) {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7514 /* 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
7515 GList *msgs = NULL;
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7516 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
7517 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
7518 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
7519 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
7520 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
7521 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
7522 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
7523 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
7524 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7525 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7526 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
7527 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
7528 PurpleConvMessage *msg = msgs->data;
21263
1812b8ccfd7a Show alias in restored conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21244
diff changeset
7529 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
7530 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7531 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
7532 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
7533 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7534
20552
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7535 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
7536 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
7537 "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
7538 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
7539 }
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7540
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7541 static void
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7542 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
7543 {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7544 int timer;
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7545 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
7546 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
7547 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
7548 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
7549 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
7550 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
7551 if (timer) {
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7552 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
7553 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
7554 }
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7555 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7556
19417
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7557 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
7558 {
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7559 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
7560 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
7561
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7562 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
7563 /* This is pretty much always the case now. */
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7564 gtkconv = PIDGIN_CONVERSATION(conv);
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7565 if (gtkconv->win != hidden_convwin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7566 return FALSE;
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7567 pidgin_conv_window_remove_gtkconv(hidden_convwin, gtkconv);
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7568 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
7569 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
7570 "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
7571 list = gtkconv->convs;
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
7572 while (list) {
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
7573 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
7574 list = list->next;
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
7575 }
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7576 return TRUE;
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7577 }
19417
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7578
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7579 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
7580 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
7581
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7582 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
7583 if (list) {
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7584 switch (purple_conversation_get_type(conv)) {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7585 case PURPLE_CONV_TYPE_IM:
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7586 {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7587 GList *convs;
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7588 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
7589 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
7590 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
7591 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
7592 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
7593 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
7594 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7595 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
7596 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
7597 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
7598 break;
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7599 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7600 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
7601 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
7602 break;
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7603 default:
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7604 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
7605 }
20051
d9a6d6ac2537 We can do this without forcing a minor bump.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20050
diff changeset
7606 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
7607 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
7608 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
7609 } else {
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7610 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
7611 "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
7612 }
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7613
19559
11849a5c3951 Update the chat topic and userlist when reattaching the Pidgin UI.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19556
diff changeset
7614 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
7615 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
7616 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
7617 }
19417
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7618
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7619 return TRUE;
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7620 }
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7621
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7622 void *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7623 pidgin_conversations_get_handle(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7624 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7625 static int handle;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7626
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7627 return &handle;
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 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7631 pidgin_conversations_init(void)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7632 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7633 void *handle = pidgin_conversations_get_handle();
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7634 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
7635
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7636 /* 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
7637 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
7638 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
7639 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
7640 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
7641 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
7642 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
7643 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
7644 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
7645 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
7646
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7647 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
7648 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
7649
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7650 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
7651 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
7652 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
7653 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
7654 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
7655 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
7656 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
7657 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
7658 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
7659
17489
747e5fd970e6 Reluctantly, I've added a preference for overriding the GTK+ default theme in GtkIMHtml widgets. There is support for this feature in the GNOME HIG and in other GTK+ (including GNOME) applications. This fixes #494. This is a GTK+ 2.4-only feature. I don't update the fonts in existing gtkimhtml's yet, only in new ones. Someone else may want to take care of that
Sean Egan <seanegan@gmail.com>
parents: 17423
diff changeset
7660 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/use_theme_font", TRUE);
17491
8e8da9a1eaac Fix default custom font
Sean Egan <seanegan@gmail.com>
parents: 17489
diff changeset
7661 purple_prefs_add_string(PIDGIN_PREFS_ROOT "/conversations/custom_font", "");
17489
747e5fd970e6 Reluctantly, I've added a preference for overriding the GTK+ default theme in GtkIMHtml widgets. There is support for this feature in the GNOME HIG and in other GTK+ (including GNOME) applications. This fixes #494. This is a GTK+ 2.4-only feature. I don't update the fonts in existing gtkimhtml's yet, only in new ones. Someone else may want to take care of that
Sean Egan <seanegan@gmail.com>
parents: 17423
diff changeset
7662
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7663 /* 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
7664 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
7665 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
7666 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
7667 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
7668 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
7669 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
7670 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
7671
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7672 /* 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
7673 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
7674 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
7675 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
7676 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
7677 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
7678
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7679 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
7680
19229
f1fb41d31c70 Set a larger default conversation size. Previously we were using
Mark Doliner <mark@kingant.net>
parents: 19223
diff changeset
7681 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
7682 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
7683
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7684 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
7685 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
7686
18779
f6656fd1d2d5 Initialize the win32 minimize new conv. windows pref to avoid warnings.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18760
diff changeset
7687 #ifdef _WIN32
f6656fd1d2d5 Initialize the win32 minimize new conv. windows pref to avoid warnings.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18760
diff changeset
7688 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
7689 #endif
f6656fd1d2d5 Initialize the win32 minimize new conv. windows pref to avoid warnings.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18760
diff changeset
7690
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7691 /* 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
7692 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
7693 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
7694 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
7695 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
7696 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
7697 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
7698 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
7699 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
7700 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
7701 tab_side_pref_cb, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7702
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7703 purple_prefs_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
7704 conv_placement_usetabs_cb, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7705
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7706 purple_prefs_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
7707 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
7708 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
7709
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
7710 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
7711 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
7712
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7713 /* 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
7714 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
7715 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
7716 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
7717 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
7718 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
7719 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
7720 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
7721 hide_new_pref_cb, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7722
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7723
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7724
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7725 /**********************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7726 * Register signals
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7727 **********************************************************************/
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7728 purple_signal_register(handle, "conversation-dragging",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7729 purple_marshal_VOID__POINTER_POINTER, NULL, 2,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7730 purple_value_new(PURPLE_TYPE_BOXED,
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7731 "PidginWindow *"),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7732 purple_value_new(PURPLE_TYPE_BOXED,
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7733 "PidginWindow *"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7734
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7735 purple_signal_register(handle, "conversation-timestamp",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7736 #if SIZEOF_TIME_T == 4
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7737 purple_marshal_POINTER__POINTER_INT_BOOLEAN,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7738 #elif SIZEOF_TIME_T == 8
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7739 purple_marshal_POINTER__POINTER_INT64_BOOLEAN,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7740 #else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7741 #error Unkown size of time_t
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7742 #endif
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7743 purple_value_new(PURPLE_TYPE_STRING), 3,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7744 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7745 PURPLE_SUBTYPE_CONVERSATION),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7746 #if SIZEOF_TIME_T == 4
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7747 purple_value_new(PURPLE_TYPE_INT),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7748 #elif SIZEOF_TIME_T == 8
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7749 purple_value_new(PURPLE_TYPE_INT64),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7750 #else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7751 # error Unknown size of time_t
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7752 #endif
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7753 purple_value_new(PURPLE_TYPE_BOOLEAN));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7754
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7755 purple_signal_register(handle, "displaying-im-msg",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7756 purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7757 purple_value_new(PURPLE_TYPE_BOOLEAN), 5,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7758 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7759 PURPLE_SUBTYPE_ACCOUNT),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7760 purple_value_new(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7761 purple_value_new_outgoing(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7762 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7763 PURPLE_SUBTYPE_CONVERSATION),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7764 purple_value_new(PURPLE_TYPE_INT));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7765
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7766 purple_signal_register(handle, "displayed-im-msg",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7767 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
7768 NULL, 5,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7769 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7770 PURPLE_SUBTYPE_ACCOUNT),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7771 purple_value_new(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7772 purple_value_new(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7773 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7774 PURPLE_SUBTYPE_CONVERSATION),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7775 purple_value_new(PURPLE_TYPE_INT));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7776
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7777 purple_signal_register(handle, "displaying-chat-msg",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7778 purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7779 purple_value_new(PURPLE_TYPE_BOOLEAN), 5,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7780 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7781 PURPLE_SUBTYPE_ACCOUNT),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7782 purple_value_new(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7783 purple_value_new_outgoing(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7784 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7785 PURPLE_SUBTYPE_CONVERSATION),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7786 purple_value_new(PURPLE_TYPE_INT));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7787
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7788 purple_signal_register(handle, "displayed-chat-msg",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7789 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
7790 NULL, 5,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7791 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7792 PURPLE_SUBTYPE_ACCOUNT),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7793 purple_value_new(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7794 purple_value_new(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7795 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7796 PURPLE_SUBTYPE_CONVERSATION),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7797 purple_value_new(PURPLE_TYPE_INT));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7798
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7799 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
7800 purple_marshal_VOID__POINTER, NULL, 1,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7801 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7802 PURPLE_SUBTYPE_CONVERSATION));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7803
19556
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7804 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
7805 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
7806 purple_value_new(PURPLE_TYPE_BOXED,
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7807 "PidginConversation *"));
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7808
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7809 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
7810 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
7811 purple_value_new(PURPLE_TYPE_BOXED,
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7812 "PidginConversation *"));
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7813
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7814 /**********************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7815 * Register commands
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7816 **********************************************************************/
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7817 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
7818 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
7819 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
7820 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
7821 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
7822 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
7823 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
7824 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
7825 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
7826 purple_cmd_register("clear", "", PURPLE_CMD_P_DEFAULT,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7827 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
7828 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
7829 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
7830 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
7831 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
7832 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
7833 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
7834 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
7835
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7836 /**********************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7837 * UI operations
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7838 **********************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7839
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7840 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
7841 G_CALLBACK(account_signed_off_cb),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7842 GINT_TO_POINTER(PURPLE_CONV_ACCOUNT_ONLINE));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7843 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
7844 G_CALLBACK(account_signed_off_cb),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7845 GINT_TO_POINTER(PURPLE_CONV_ACCOUNT_OFFLINE));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7846
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7847 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
7848 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
7849
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7850 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
7851
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7852 hidden_convwin = pidgin_conv_window_new();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7853 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
7854
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7855 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
7856 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
7857
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7858 /* Callbacks to update a conversation */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7859 purple_signal_connect(blist_handle, "buddy-added", handle,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7860 G_CALLBACK(buddy_update_cb), NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7861 purple_signal_connect(blist_handle, "buddy-removed", handle,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7862 G_CALLBACK(buddy_update_cb), NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7863 purple_signal_connect(blist_handle, "buddy-signed-on",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7864 handle, PURPLE_CALLBACK(update_buddy_sign), "on");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7865 purple_signal_connect(blist_handle, "buddy-signed-off",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7866 handle, PURPLE_CALLBACK(update_buddy_sign), "off");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7867 purple_signal_connect(blist_handle, "buddy-status-changed",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7868 handle, PURPLE_CALLBACK(update_buddy_status_changed), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7869 purple_signal_connect(blist_handle, "buddy-privacy-changed",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7870 handle, PURPLE_CALLBACK(update_buddy_privacy_changed), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7871 purple_signal_connect(blist_handle, "buddy-idle-changed",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7872 handle, PURPLE_CALLBACK(update_buddy_idle_changed), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7873 purple_signal_connect(blist_handle, "buddy-icon-changed",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7874 handle, PURPLE_CALLBACK(update_buddy_icon), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7875 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
7876 handle, PURPLE_CALLBACK(update_buddy_typing), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7877 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
7878 handle, PURPLE_CALLBACK(update_buddy_typing), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7879 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
7880 handle, PURPLE_CALLBACK(update_conversation_switched), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7881 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
7882 PURPLE_CALLBACK(update_chat), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7883 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
7884 PURPLE_CALLBACK(update_chat), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7885 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
7886 PURPLE_CALLBACK(update_chat_topic), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7887 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
7888 PURPLE_CALLBACK(pidgin_conv_updated), NULL,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7889 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
7890 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
7891 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
7892 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
7893 PURPLE_CALLBACK(wrote_msg_update_unseen_cb), NULL);
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7894
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7895 {
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7896 /* Set default tab colors */
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7897 GString *str = g_string_new(NULL);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7898 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
7899 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
7900 struct {
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7901 const char *stylename;
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7902 const char *labelname;
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7903 const char *color;
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7904 } styles[] = {
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7905 {"pidgin_tab_label_typing_default", "tab-label-typing", "#4e9a06"},
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7906 {"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
7907 {"pidgin_tab_label_attention_default", "tab-label-attention", "#006aff"},
21704
a4b36b22ea94 New style.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21703
diff changeset
7908 {"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
7909 {"pidgin_tab_label_event_default", "tab-label-event", "#888a85"},
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7910 {NULL, NULL, NULL}
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7911 };
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7912 int iter;
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7913 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
7914 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
7915 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
7916 (parent && now && parent->rc_style == now->rc_style)) {
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7917 g_string_append_printf(str, "style \"%s\" {\n"
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7918 "fg[ACTIVE] = \"%s\"\n"
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7919 "}\n"
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7920 "widget \"*%s\" style \"%s\"\n",
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7921 styles[iter].stylename,
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7922 styles[iter].color,
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7923 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
7924 }
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7925 }
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7926 gtk_rc_parse_string(str->str);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7927 g_string_free(str, TRUE);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7928 #if GTK_CHECK_VERSION(2,4,0)
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7929 gtk_rc_reset_styles(settings);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7930 #endif
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7931 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7932 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7933
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7934 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7935 pidgin_conversations_uninit(void)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7936 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7937 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
7938 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
7939 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
7940 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7941
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7942
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7943
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7944
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7945
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7946
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7947
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7948
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7949
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7950
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7951
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7952
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7953
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7954
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7957 /* 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
7958 * 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
7959
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7960 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7961 * @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
7962 * @ingroup pidgin
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7963 *
15871
66dff3dfdea6 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
7964 * pidgin
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7965 *
15871
66dff3dfdea6 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
7966 * 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
7967 * 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
7968 * source distribution.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7969 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7970 * 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
7971 * 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
7972 * 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
7973 * (at your option) any later version.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7974 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7975 * 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
7976 * 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
7977 * 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
7978 * GNU General Public License for more details.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7979 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7980 * 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
7981 * 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
7982 * 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
7983 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7984 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7985 #include "internal.h"
15514
535f002e7b0f More pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15509
diff changeset
7986 #include "pidgin.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7987
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7988
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7989 #include <gdk/gdkkeysyms.h>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7990
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7991 #include "account.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7992 #include "cmds.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7993 #include "debug.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7994 #include "imgstore.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7995 #include "log.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7996 #include "notify.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7997 #include "prpl.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7998 #include "request.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7999 #include "util.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8000
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8001 #include "gtkdnd-hints.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8002 #include "gtkblist.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8003 #include "gtkconv.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8004 #include "gtkdialogs.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8005 #include "gtkmenutray.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8006 #include "gtkpounce.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8007 #include "gtkprefs.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8008 #include "gtkprivacy.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8009 #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
8010 #include "pidginstock.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8011 #include "gtkimhtml.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8012 #include "gtkimhtmltoolbar.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8013
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8014 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8015 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
8016 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8017 gtk_widget_destroy(warn_close_dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8018 warn_close_dialog = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8019
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8020 if (resp == GTK_RESPONSE_OK)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8021 pidgin_conv_window_destroy(win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8022 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8023
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8024 static void
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8025 build_warn_close_dialog(PidginWindow *gtkwin)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8026 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8027 GtkWidget *label;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8028 GtkWidget *vbox, *hbox;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8029 GtkWidget *img;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8030
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8031 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
8032
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8033
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8034 warn_close_dialog = gtk_dialog_new_with_buttons(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8035 _("Confirm close"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8036 GTK_WINDOW(gtkwin->window), GTK_DIALOG_MODAL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8037 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
8038 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
8039
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8040 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
8041 GTK_RESPONSE_OK);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8042
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8043 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
8044 6);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8045 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
8046 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
8047 FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8048
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8049 /* Setup the outside spacing. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8050 vbox = GTK_DIALOG(warn_close_dialog)->vbox;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8051
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8052 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
8053 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
8054
15436
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15435
diff changeset
8055 img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_WARNING,
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15435
diff changeset
8056 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
8057 /* 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
8058 hbox = gtk_hbox_new(FALSE, 12);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8059 gtk_container_add(GTK_CONTAINER(vbox), hbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8060 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
8061 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
8062
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8063 /* Setup the right vbox. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8064 vbox = gtk_vbox_new(FALSE, 12);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8065 gtk_container_add(GTK_CONTAINER(hbox), vbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8066
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8067 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
8068 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
8069 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
8070 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
8071 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
8072
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8073 /* Connect the signals. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8074 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
8075 G_CALLBACK(do_close), gtkwin);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8076
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8077 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8078
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8079 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8080 * Callbacks
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8081 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8082
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8083 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8084 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
8085 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8086 PidginWindow *win = d;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8087 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8088
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8089 /* 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
8090 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
8091 l != NULL; l = l->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8092 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8093 PidginConversation *gtkconv = l->data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8094 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
8095 gtkconv->unseen_state >= PIDGIN_UNSEEN_TEXT)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8096 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8097 build_warn_close_dialog(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8098 gtk_widget_show_all(warn_close_dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8099
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8100 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8101 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8102 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8103
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8104 pidgin_conv_window_destroy(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8105
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8106 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8107 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8108
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8109 static void
20953
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8110 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
8111 {
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8112 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
8113 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
8114
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8115 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
8116 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
8117
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8118 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
8119 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
8120
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8121 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
8122 {
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8123 unseen_count = 0;
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8124 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
8125 }
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8126 else
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8127 {
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8128 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
8129 unseen_count++;
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8130
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8131 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
8132 unseen_state = state;
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8133 }
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8134
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8135 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
8136 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
8137
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8138 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
8139 }
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8140
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8141 static void
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
8142 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
8143 {
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
8144 if (state == PIDGIN_UNSEEN_NONE)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8145 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8146 gtkconv->unseen_count = 0;
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
8147 gtkconv->unseen_state = PIDGIN_UNSEEN_NONE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8148 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8149 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8150 {
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
8151 if (state >= PIDGIN_UNSEEN_TEXT)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8152 gtkconv->unseen_count++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8153
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8154 if (state > gtkconv->unseen_state)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8155 gtkconv->unseen_state = state;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8156 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8157
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8158 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
8159 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8160
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8161 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8162 * 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
8163 * 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
8164 * messages.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8165 */
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
8166 static gboolean
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8167 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
8168 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8169 PidginWindow *win = d;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8170 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
8171
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
8172 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
8173 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
8174
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8175 return FALSE;
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 #if !GTK_CHECK_VERSION(2,6,0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8179 /* Courtesy of Galeon! */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8180 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8181 tab_close_button_state_changed_cb(GtkWidget *widget, GtkStateType prev_state)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8182 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8183 if (GTK_WIDGET_STATE(widget) == GTK_STATE_ACTIVE)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8184 gtk_widget_set_state(widget, GTK_STATE_NORMAL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8185 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8186 #endif
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 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8189 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
8190 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8191 static GdkCursor *cursor = NULL;
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 gtkwin->in_drag = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8194
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8195 if (gtkwin->drag_leave_signal) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8196 g_signal_handler_disconnect(G_OBJECT(widget),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8197 gtkwin->drag_leave_signal);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8198 gtkwin->drag_leave_signal = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8199 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8200
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8201 if (cursor == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8202 cursor = gdk_cursor_new(GDK_FLEUR);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8203
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8204 /* Grab the pointer */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8205 gtk_grab_add(gtkwin->notebook);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8206 #ifndef _WIN32
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8207 /* 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
8208 always be true after a button press. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8209 if (!gdk_pointer_is_grabbed())
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8210 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8211 gdk_pointer_grab(gtkwin->notebook->window, FALSE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8212 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
8213 NULL, cursor, GDK_CURRENT_TIME);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8214 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8215
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8216 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8217 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
8218 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8219
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8220 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8221 * 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
8222 * drag to be initiated.
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 if (win->in_predrag) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8225 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
8226 e->x_root >= win->drag_max_x ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8227 e->y_root < win->drag_min_y ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8228 e->y_root >= win->drag_max_y) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8229
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8230 win->in_predrag = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8231 notebook_init_grab(win, widget);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8232 }
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 else { /* Otherwise, draw the arrows. */
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8235 PidginWindow *dest_win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8236 GtkNotebook *dest_notebook;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8237 GtkWidget *tab;
17112
bee4ea11e299 Fix the tab-dragging arrows in conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17111
diff changeset
8238 gint page_num;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8239 gboolean horiz_tabs = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8240 gboolean to_right = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8241
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8242 /* 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
8243 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
8244
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8245 if (dest_win == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8246 dnd_hints_hide_all();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8247
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8248 return TRUE;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8251 dest_notebook = GTK_NOTEBOOK(dest_win->notebook);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8252
22193
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
8253 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
8254 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
8255 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
8256 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
8257 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
8258 } else {
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
8259 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
8260 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
8261 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
8262 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8263
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8264 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
8265 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
8266 horiz_tabs = TRUE;
bee4ea11e299 Fix the tab-dragging arrows in conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17111
diff changeset
8267 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8268
22193
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
8269 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
8270 {
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
8271 /* 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
8272 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
8273 return TRUE;
19235
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8274 } else if (horiz_tabs) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8275 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
8276 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
8277 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
8278 } else {
bee4ea11e299 Fix the tab-dragging arrows in conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17111
diff changeset
8279 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
8280 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
8281 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8282 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8283 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
8284 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
8285 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
8286 } else {
bee4ea11e299 Fix the tab-dragging arrows in conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17111
diff changeset
8287 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
8288 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
8289 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8290 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8291 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8292
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8293 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8294 }
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 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8297 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
8298 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8299 if (win->in_drag)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8300 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8301
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8302 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
8303 e->x_root >= win->drag_max_x ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8304 e->y_root < win->drag_min_y ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8305 e->y_root >= win->drag_max_y) {
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 win->in_predrag = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8308 notebook_init_grab(win, widget);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8309 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8310
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8311 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8312 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8313
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8314 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8315 * THANK YOU GALEON!
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8316 */
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
8317
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
8318 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
8319 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
8320 {
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
8321 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
8322 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
8323 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
8324 }
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
8325
18523
0a8f9829640f Show the 'send to' menu on right click on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18465
diff changeset
8326 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
8327 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
8328
19235
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8329 if (e->button == 1) {
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8330 int nb_x, nb_y;
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8331
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8332 if (gtkconv->win->in_drag)
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8333 return TRUE;
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8334
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8335 gtkconv->win->in_predrag = TRUE;
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8336 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
8337
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8338 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
8339
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8340 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
8341 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
8342 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
8343 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
8344
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8345 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
8346 G_CALLBACK(notebook_motion_cb), gtkconv->win);
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8347 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
8348 G_CALLBACK(notebook_leave_cb), gtkconv->win);
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8349 return FALSE;
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8350 }
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8351
18523
0a8f9829640f Show the 'send to' menu on right click on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18465
diff changeset
8352 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
8353 /* 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
8354 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
8355 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
8356 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
8357
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
8358 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
8359 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
8360 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
8361 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
8362 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
8363 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
8364 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
8365 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
8366 } 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
8367 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
8368 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
8369 }
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
8370
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
8371 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
8372 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
8373 return TRUE;
18671
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
8374 }
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
8375 return FALSE;
18671
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
8376 }
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
8377
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8378 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8379 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
8380 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8381 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
8382 int tab_clicked;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8383 GtkWidget *page;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8384 GtkWidget *tab;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8385
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
8386 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
8387 PidginConversation *gtkconv;
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8388 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
8389
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8390 if (tab_clicked == -1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8391 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8392
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8393 gtkconv = pidgin_conv_window_get_gtkconv_at_index(win, tab_clicked);
18797
0622a7f08dde smaller close buttons on tabs. I think this looks really good.
Sean Egan <seanegan@gmail.com>
parents: 18796
diff changeset
8394 close_conv_cb(NULL, NULL, gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8395 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8396 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8397
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8398
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8399 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
8400 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8401
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8402
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8403 if (win->in_drag) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8404 purple_debug(PURPLE_DEBUG_WARNING, "gtkconv",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8405 "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
8406 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8407 }
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 * 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
8411 * mess things up.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8412 */
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8413 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
8414
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8415 if (tab_clicked == -1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8416 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8417
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8418 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8419 * 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
8420 * the position of the notebook.
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 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
8423
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8424 x_rel = e->x_root - nb_x;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8425 y_rel = e->y_root - nb_y;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8426
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8427 /* Reset the min/max x/y */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8428 win->drag_min_x = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8429 win->drag_min_y = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8430 win->drag_max_x = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8431 win->drag_max_y = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8432
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8433 /* Find out which tab was dragged. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8434 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
8435 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
8436
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8437 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
8438 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
8439 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
8440 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
8441
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8442 /* 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
8443 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
8444 e->x_root >= win->drag_max_x ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8445 e->y_root < win->drag_min_y ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8446 e->y_root >= win->drag_max_y) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8447
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8448 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8449 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8450
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8451 win->in_predrag = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8452 win->drag_tab = tab_clicked;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8453
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8454 /* Connect the new motion signals. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8455 win->drag_motion_signal =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8456 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
8457 G_CALLBACK(notebook_motion_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8458
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8459 win->drag_leave_signal =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8460 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
8461 G_CALLBACK(notebook_leave_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8462
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8463 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8464 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8465
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8466 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8467 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
8468 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8469 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
8470 GtkNotebook *dest_notebook;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8471 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8472 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8473 gint dest_page_num = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8474 gboolean new_window = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8475 gboolean to_right = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8476
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8477 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8478 * 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
8479 * 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
8480 * close button.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8481 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8482 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
8483 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8484
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8485 if (gdk_pointer_is_grabbed()) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8486 gdk_pointer_ungrab(GDK_CURRENT_TIME);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8487 gtk_grab_remove(widget);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8488 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8489
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8490 if (!win->in_predrag && !win->in_drag)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8491 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8492
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8493 /* Disconnect the motion signal. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8494 if (win->drag_motion_signal) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8495 g_signal_handler_disconnect(G_OBJECT(widget),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8496 win->drag_motion_signal);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8497
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8498 win->drag_motion_signal = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8499 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8500
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8501 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8502 * 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
8503 * signal.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8504 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8505 if (win->in_predrag) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8506 win->in_predrag = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8507
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8508 if (win->drag_leave_signal) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8509 g_signal_handler_disconnect(G_OBJECT(widget),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8510 win->drag_leave_signal);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8511
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8512 win->drag_leave_signal = 0;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8516 /* If we're not in drag... */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8517 /* We're perfectly normal people! */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8518 if (!win->in_drag)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8519 return FALSE;
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 win->in_drag = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8522
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8523 dnd_hints_hide_all();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8524
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8525 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
8526
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8527 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
8528
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8529 if (dest_win == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8530 /* 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
8531 * 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
8532 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
8533 /* 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
8534 dest_win = pidgin_conv_window_new();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8535 new_window = TRUE;
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8538
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8539 if (dest_win == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8540 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8541
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8542 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
8543 "conversation-dragging", win, dest_win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8544
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8545 /* 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
8546 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
8547 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
8548 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
8549 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
8550 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
8551 } else {
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
8552 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
8553 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
8554 }
6d9757319bf6 Fix some issues with the infopane and dragging when the infopane takes the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22154
diff changeset
8555 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8556
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8557 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
8558
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8559 if (win == dest_win) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8560 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
8561 } else {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8562 pidgin_conv_window_remove_gtkconv(win, gtkconv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8563 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
8564 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
8565 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
8566 if (new_window) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8567 gint win_width, win_height;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8568
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8569 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
8570 &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
8571 #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
8572 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
8573 e->x_root - (win_width / 2),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8574 e->y_root - (win_height / 2));
19614
16776040e347 ifdef win32 the conversation placement code
Sean Egan <seanegan@gmail.com>
parents: 19600
diff changeset
8575 #endif
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8576
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8577 pidgin_conv_window_show(dest_win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8578 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8579 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8580
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8581 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
8582
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8583 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8584 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8585
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8586
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8587 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8588 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
8589 gpointer user_data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8590 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8591 PidginWindow *win;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8592 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8593 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8594
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8595 win = user_data;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8596 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
8597
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8598 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8599
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8600 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
8601 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8602
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8603 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8604
17278
591d6c3e9f1f Stop the typing icon timer before switching conversations so the typing
Stu Tomlinson <stu@nosnilmot.com>
parents: 17257
diff changeset
8605 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
8606 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
8607 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
8608 }
591d6c3e9f1f Stop the typing icon timer before switching conversations so the typing
Stu Tomlinson <stu@nosnilmot.com>
parents: 17257
diff changeset
8609
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8610 stop_anim(NULL, gtkconv);
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 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8613 close_window(GtkWidget *w, PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8614 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8615 close_win_cb(w, NULL, win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8616 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8617
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8618 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8619 detach_tab_cb(GtkWidget *w, GObject *menu)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8620 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8621 PidginWindow *win, *new_window;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8622 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8623
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8624 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
8625
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8626 if (!gtkconv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8627 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8628
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8629 win = pidgin_conv_get_window(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8630 /* 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
8631 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
8632 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8633
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8634 pidgin_conv_window_remove_gtkconv(win, gtkconv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8635
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8636 new_window = pidgin_conv_window_new();
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8637 pidgin_conv_window_add_gtkconv(new_window, gtkconv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8638 pidgin_conv_window_show(new_window);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8639 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8640
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8641 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8642 close_others_cb(GtkWidget *w, GObject *menu)
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 GList *iter;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8645 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8646 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8647
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8648 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
8649
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8650 if (!gtkconv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8651 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8652
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8653 win = pidgin_conv_get_window(gtkconv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8654
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8655 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
8656 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8657 PidginConversation *gconv = iter->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8658 iter = iter->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8659
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8660 if (gconv != gtkconv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8661 {
18797
0622a7f08dde smaller close buttons on tabs. I think this looks really good.
Sean Egan <seanegan@gmail.com>
parents: 18796
diff changeset
8662 close_conv_cb(NULL, NULL, gconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8663 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8664 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8665 }
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 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
8668 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8669 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8670
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8671 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
8672
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8673 if (gtkconv)
18797
0622a7f08dde smaller close buttons on tabs. I think this looks really good.
Sean Egan <seanegan@gmail.com>
parents: 18796
diff changeset
8674 close_conv_cb(NULL, NULL, gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8675 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8676
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8677 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8678 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
8679 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8680 GtkWidget *item, *menu;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8681 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8682
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8683 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
8684 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8685
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8686 gtkconv = pidgin_conv_window_get_gtkconv_at_index(win,
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8687 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
8688
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8689 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
8690 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8691 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
8692 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8693 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8694
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8695 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
8696
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8697 menu = notebook->menu;
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
8698 pidgin_separator(GTK_WIDGET(menu));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8699
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8700 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
8701 gtk_widget_show(item);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8702 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
8703 g_signal_connect(G_OBJECT(item), "activate",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8704 G_CALLBACK(close_others_cb), menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8705
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8706 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
8707 gtk_widget_show(item);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8708 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
8709 g_signal_connect(G_OBJECT(item), "activate",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8710 G_CALLBACK(close_window), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8711
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
8712 pidgin_separator(menu);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8713
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8714 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
8715 gtk_widget_show(item);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8716 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
8717 g_signal_connect(G_OBJECT(item), "activate",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8718 G_CALLBACK(detach_tab_cb), menu);
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 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
8721 gtk_widget_show(item);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8722 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
8723 g_signal_connect(G_OBJECT(item), "activate",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8724 G_CALLBACK(close_tab_cb), menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8725
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8726 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8727 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8728
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8729 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
8730 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
8731 {
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
8732 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
8733 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
8734 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
8735 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
8736 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
8737 }
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
8738
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
8739 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
8740 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
8741 {
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
8742 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
8743 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
8744 }
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
8745
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
8746 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
8747 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
8748 {
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
8749 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
8750 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
8751 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
8752 }
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
8753 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
8754 }
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
8755
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
8756 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
8757 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
8758 {
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
8759 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
8760 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
8761 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
8762 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
8763
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
8764 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
8765 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
8766 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
8767 }
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
8768 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
8769 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
8770 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
8771
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
8772 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
8773 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
8774 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
8775 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
8776 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
8777 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
8778 }
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
8779 serv_alias_buddy(buddy);
21731
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8780 } 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
8781 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
8782 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
8783 }
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8784 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
8785 }
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8786
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8787 static gboolean
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8788 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
8789 {
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8790 GtkWidget *entry = NULL;
21731
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8791 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
8792 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
8793
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
8794 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
8795 /* 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
8796 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
8797 }
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8798
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
8799 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
8800 /* 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
8801 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
8802 }
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
8803
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
8804 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
8805 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
8806 if (!buddy)
21731
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8807 /* 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
8808 return FALSE;
21731
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8809
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
8810 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
8811 } 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
8812 PurpleConnection *gc;
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8813 PurplePluginProtocolInfo *prpl_info = NULL;
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8814
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8815 gc = purple_conversation_get_gc(conv);
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8816 if (gc != NULL)
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8817 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8818 if (prpl_info && prpl_info->set_chat_topic == NULL)
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8819 /* 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
8820 return FALSE;
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8821
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
8822 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
8823 }
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
8824
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
8825 /* 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
8826 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
8827 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
8828 gtk_entry_set_width_chars(GTK_ENTRY(entry), 10);
17423
ae30f9913bb4 Fix for gtk < 2.4
Stu Tomlinson <stu@nosnilmot.com>
parents: 17294
diff changeset
8829 #if GTK_CHECK_VERSION(2,4,0)
17106
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8830 gtk_entry_set_alignment(GTK_ENTRY(entry), 0.5);
17423
ae30f9913bb4 Fix for gtk < 2.4
Stu Tomlinson <stu@nosnilmot.com>
parents: 17294
diff changeset
8831 #endif
17106
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8832
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
8833 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
8834 /* 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
8835 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
8836
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
8837 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
8838 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
8839 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
8840
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8841 if (text != NULL)
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8842 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
8843 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
8844 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
8845 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
8846
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8847 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8848 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8849
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8850 static gboolean
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8851 window_keypress_cb(GtkWidget *widget, GdkEventKey *event, PidginWindow *win)
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8852 {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8853 PidginConversation *gtkconv = pidgin_conv_window_get_active_gtkconv(win);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8854
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8855 return conv_keypress_common(gtkconv, event);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8856 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8857
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
8858 static void
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8859 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
8860 gpointer user_data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8861 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8862 PidginWindow *win;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8863 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8864 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8865 const char *sound_method;
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 win = user_data;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8868 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
8869 conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8870
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8871 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8872
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8873 /* clear unseen flag if conversation is not hidden */
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8874 if(!pidgin_conv_is_hidden(gtkconv)) {
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
8875 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
8876 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8877
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8878 /* Update the menubar */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8879
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8880 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
8881 purple_conversation_is_logging(conv));
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 generate_send_to_items(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8884 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
8885 regenerate_plugins_items(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8886
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8887 pidgin_conv_switch_active_conversation(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8888
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
8889 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
8890 if (strcmp(sound_method, "none") != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8891 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
8892 gtkconv->make_sound);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8893
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8894 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
8895 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
8896
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8897 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
8898 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
8899
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8900 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8901 * 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
8902 * 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
8903 */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8904 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
8905 (gtkconv->u.im->animate))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8906 start_anim(NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8907
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8908 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
8909 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8910
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8911 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8912 * GTK+ window ops
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8915 GList *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8916 pidgin_conv_windows_get_list()
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8917 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8918 return window_list;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8919 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8920
16315
ee4ce3c4186f Fix #248 (Control shouldn't steal focus from scrollback)
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16286
diff changeset
8921 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
8922 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
8923 {
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8924 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
8925 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
8926 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
8927 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
8928 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
8929 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
8930 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
8931 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
8932 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
8933 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
8934 }
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8935
16315
ee4ce3c4186f Fix #248 (Control shouldn't steal focus from scrollback)
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16286
diff changeset
8936 static void
ee4ce3c4186f Fix #248 (Control shouldn't steal focus from scrollback)
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16286
diff changeset
8937 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
8938 {
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8939 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
8940 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
8941 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
8942 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
8943 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
8944 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
8945 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
8946 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
8947 }
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8948
17392
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
8949 static void
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
8950 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
8951 {
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
8952 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
8953 }
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
8954
18328
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8955 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
8956 int x, y;
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8957
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8958 if (GTK_WIDGET_VISIBLE(w))
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8959 gtk_window_get_position(GTK_WINDOW(w), &x, &y);
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8960 else
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8961 return FALSE; /* carry on normally */
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8962
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8963 /* Workaround for GTK+ bug # 169811 - "configure_event" is fired
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8964 * when the window is being maximized */
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8965 if (gdk_window_get_state(w->window) & GDK_WINDOW_STATE_MAXIMIZED)
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8966 return FALSE;
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8967
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8968 /* don't save off-screen positioning */
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8969 if (x + event->width < 0 ||
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8970 y + event->height < 0 ||
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8971 x > gdk_screen_width() ||
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8972 y > gdk_screen_height())
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8973 return FALSE; /* carry on normally */
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8974
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
8975 /* 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
8976 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
8977 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
8978 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
8979 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
8980
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8981 /* continue to handle event normally */
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8982 return FALSE;
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8983
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8984 }
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8985
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
8986 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
8987 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
8988 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
8989 {
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
8990 /* 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
8991 * 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
8992 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
8993 !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
8994
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
8995 /* ...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
8996 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
8997 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
8998 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
8999 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
9000
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9001 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
9002 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
9003 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
9004 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
9005
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9006 /* ...and move it back. */
22669
101d16be1521 Stop restoring conversation window locations on !Windows, I wasn't aware this
Etan Reisner <pidgin@unreliablesource.net>
parents: 22647
diff changeset
9007 #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
9008 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
9009 #endif
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9010 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
9011 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9012 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9013
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9014 static void
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9015 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
9016 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
9017 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
9018 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
9019 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
9020 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
9021 }
672dd03f538a More work on the conversation sizing/positioning stuff. Still nothing IM or chat specific
Sean Egan <seanegan@gmail.com>
parents: 18621
diff changeset
9022
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9023 PidginWindow *
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9024 pidgin_conv_window_new()
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9025 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9026 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9027 GtkPositionType pos;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9028 GtkWidget *testidea;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9029 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
9030 #if GTK_CHECK_VERSION(2,6,0)
f43d7aafe1f8 Use gtk_window_set_focus_on_map() to prevent focus on new conversation windows (hopefully only) when the new window was prompted by an external event. This seems to work pretty well, but I suppose those with higher expectations of their WM will be sure to tell me if this messes something up. References #3618.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21000
diff changeset
9031 GdkModifierType state;
f43d7aafe1f8 Use gtk_window_set_focus_on_map() to prevent focus on new conversation windows (hopefully only) when the new window was prompted by an external event. This seems to work pretty well, but I suppose those with higher expectations of their WM will be sure to tell me if this messes something up. References #3618.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21000
diff changeset
9032 #endif
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9033
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9034 win = g_malloc0(sizeof(PidginWindow));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9035
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9036 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
9037
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9038 /* Create the window. */
17166
92c3c2eeba87 Added to gtkutils.c:
Gabriel Schulhof <nix@go-nix.ca>
parents: 17116
diff changeset
9039 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
9040 #if GTK_CHECK_VERSION(2,6,0)
f43d7aafe1f8 Use gtk_window_set_focus_on_map() to prevent focus on new conversation windows (hopefully only) when the new window was prompted by an external event. This seems to work pretty well, but I suppose those with higher expectations of their WM will be sure to tell me if this messes something up. References #3618.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21000
diff changeset
9041 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
9042 gtk_window_set_focus_on_map(GTK_WINDOW(win->window), FALSE);
f43d7aafe1f8 Use gtk_window_set_focus_on_map() to prevent focus on new conversation windows (hopefully only) when the new window was prompted by an external event. This seems to work pretty well, but I suppose those with higher expectations of their WM will be sure to tell me if this messes something up. References #3618.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21000
diff changeset
9043 #endif
22669
101d16be1521 Stop restoring conversation window locations on !Windows, I wasn't aware this
Etan Reisner <pidgin@unreliablesource.net>
parents: 22647
diff changeset
9044 /* 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
9045 * 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
9046 * 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
9047 * 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
9048 #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
9049 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
9050 #endif
17260
baaf2cf9339c disapproval of revision '1f819f5ad330efa81ac7906f854b46f0c8bbd7b6'
Ethan Blanton <elb@pidgin.im>
parents: 17259
diff changeset
9051
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
9052 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
9053 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
9054 }
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
9055
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9056 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
9057 G_CALLBACK(close_win_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9058 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
9059 G_CALLBACK(focus_win_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9060
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
9061 /* Intercept keystrokes from the menu items */
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
9062 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
9063 G_CALLBACK(window_keypress_cb), win);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
9064
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
9065
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9066 /* Create the notebook. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9067 win->notebook = gtk_notebook_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9068
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
9069 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
9070
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9071 #if 0
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9072 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
9073 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
9074 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9075 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
9076 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
9077 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
9078 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
9079 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
9080
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9081 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
9082 G_CALLBACK(right_click_menu_cb), win);
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 gtk_widget_show(win->notebook);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9085
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9086 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
9087 G_CALLBACK(before_switch_conv_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9088 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
9089 G_CALLBACK(switch_conv_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9090
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9091 /* Setup the tab drag and drop signals. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9092 gtk_widget_add_events(win->notebook,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9093 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
9094 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
9095 G_CALLBACK(notebook_press_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9096 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
9097 G_CALLBACK(notebook_release_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9098
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9099 testidea = gtk_vbox_new(FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9100
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9101 /* Setup the menubar. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9102 menubar = setup_menubar(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9103 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
9104
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9105 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
9106
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9107 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
9108
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9109 gtk_widget_show(testidea);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9110
17392
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
9111 /* 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
9112 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
9113 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
9114 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
9115 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
9116
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
9117
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9118 #ifdef _WIN32
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9119 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
9120 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
9121
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
9122 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
9123 && !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
9124 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
9125 #endif
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 return win;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9130 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9131 pidgin_conv_window_destroy(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9132 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9133 purple_prefs_disconnect_by_handle(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9134 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
9135
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9136 /* 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
9137 if (win->dialogs.search)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9138 gtk_widget_destroy(win->dialogs.search);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9139
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9140 if (win->gtkconvs) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9141 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
9142 gboolean last = (win->gtkconvs->next == NULL);
fee0eea83e58 Honour the persistency when closing the window from the WM.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20051
diff changeset
9143 close_conv_cb(NULL, NULL, win->gtkconvs->data);
fee0eea83e58 Honour the persistency when closing the window from the WM.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20051
diff changeset
9144 if (last)
fee0eea83e58 Honour the persistency when closing the window from the WM.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20051
diff changeset
9145 break;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9146 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9147 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9148 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9149 gtk_widget_destroy(win->window);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9150
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9151 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
9152
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9153 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
9154 purple_signals_disconnect_by_handle(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9155
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9156 g_free(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9157 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9158
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9159 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9160 pidgin_conv_window_show(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9161 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9162 gtk_widget_show(win->window);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9163 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9164
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9165 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9166 pidgin_conv_window_hide(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9167 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9168 gtk_widget_hide(win->window);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9169 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9170
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9171 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9172 pidgin_conv_window_raise(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9173 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9174 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
9175 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9176
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9177 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9178 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
9179 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9180 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
9181 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
9182 gtkconv->tab_cont));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9183 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9184
18864
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9185 static gboolean
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9186 close_button_left_cb(GtkWidget *widget, GdkEventCrossing *event, GtkLabel *label)
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9187 {
19232
4b8238290a94 Make the close-button underlined, instead of bold, and change the cursor to hand.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19231
diff changeset
9188 static GdkCursor *ptr = NULL;
4b8238290a94 Make the close-button underlined, instead of bold, and change the cursor to hand.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19231
diff changeset
9189 if (ptr == NULL) {
4b8238290a94 Make the close-button underlined, instead of bold, and change the cursor to hand.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19231
diff changeset
9190 ptr = gdk_cursor_new(GDK_LEFT_PTR);
4b8238290a94 Make the close-button underlined, instead of bold, and change the cursor to hand.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19231
diff changeset
9191 }
4b8238290a94 Make the close-button underlined, instead of bold, and change the cursor to hand.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19231
diff changeset
9192
18864
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9193 gtk_label_set_markup(label, "×");
19232
4b8238290a94 Make the close-button underlined, instead of bold, and change the cursor to hand.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19231
diff changeset
9194 gdk_window_set_cursor(event->window, ptr);
18864
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9195 return FALSE;
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9196 }
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9197
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9198 static gboolean
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9199 close_button_entered_cb(GtkWidget *widget, GdkEventCrossing *event, GtkLabel *label)
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9200 {
19232
4b8238290a94 Make the close-button underlined, instead of bold, and change the cursor to hand.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19231
diff changeset
9201 static GdkCursor *hand = NULL;
4b8238290a94 Make the close-button underlined, instead of bold, and change the cursor to hand.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19231
diff changeset
9202 if (hand == NULL) {
4b8238290a94 Make the close-button underlined, instead of bold, and change the cursor to hand.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19231
diff changeset
9203 hand = gdk_cursor_new(GDK_HAND2);
4b8238290a94 Make the close-button underlined, instead of bold, and change the cursor to hand.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19231
diff changeset
9204 }
4b8238290a94 Make the close-button underlined, instead of bold, and change the cursor to hand.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19231
diff changeset
9205
4b8238290a94 Make the close-button underlined, instead of bold, and change the cursor to hand.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19231
diff changeset
9206 gtk_label_set_markup(label, "<u>×</u>");
4b8238290a94 Make the close-button underlined, instead of bold, and change the cursor to hand.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19231
diff changeset
9207 gdk_window_set_cursor(event->window, hand);
18864
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9208 return FALSE;
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9209 }
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9210
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9211 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9212 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
9213 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9214 PurpleConversation *conv = gtkconv->active_conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9215 PidginConversation *focus_gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9216 GtkWidget *tab_cont = gtkconv->tab_cont;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9217 GtkWidget *close_image;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9218 PurpleConversationType conv_type;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9219 const gchar *tmp_lab;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9220
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9221 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
9222
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9223 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
9224 gtkconv->win = win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9225
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
9226 if (win->gtkconvs && win->gtkconvs->next && win->gtkconvs->next->next == NULL)
5610c2ea0d94 revert 'no visible tabs when only one conversation' as it proved unpopular. Made tabs only fill the entire width of the notebook when there's only one tab to avoid http://pidgin.im/~deryni/that_just_looks_dumb.png
Sean Egan <seanegan@gmail.com>
parents: 18602
diff changeset
9227 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
9228
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
9229
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9230 /* Close button. */
18797
0622a7f08dde smaller close buttons on tabs. I think this looks really good.
Sean Egan <seanegan@gmail.com>
parents: 18796
diff changeset
9231 gtkconv->close = gtk_event_box_new();
20286
0ce367508ab6 Fix for compiling with Gtk < 2.4, references #3144
Stu Tomlinson <stu@nosnilmot.com>
parents: 20251
diff changeset
9232 #if GTK_CHECK_VERSION(2,4,0)
18821
0765cf9331f6 warning fixes
Sean Egan <seanegan@gmail.com>
parents: 18820
diff changeset
9233 gtk_event_box_set_visible_window(GTK_EVENT_BOX(gtkconv->close), FALSE);
20286
0ce367508ab6 Fix for compiling with Gtk < 2.4, references #3144
Stu Tomlinson <stu@nosnilmot.com>
parents: 20251
diff changeset
9234 #endif
18864
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9235 gtk_widget_set_events(gtkconv->close, GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK);
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
9236 close_image = gtk_label_new("×");
18864
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9237 g_signal_connect(G_OBJECT(gtkconv->close), "enter-notify-event", G_CALLBACK(close_button_entered_cb), close_image);
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9238 g_signal_connect(G_OBJECT(gtkconv->close), "leave-notify-event", G_CALLBACK(close_button_left_cb), close_image);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9239 gtk_widget_show(close_image);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9240 gtk_container_add(GTK_CONTAINER(gtkconv->close), close_image);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9241 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
9242 _("Close conversation"), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9243
18797
0622a7f08dde smaller close buttons on tabs. I think this looks really good.
Sean Egan <seanegan@gmail.com>
parents: 18796
diff changeset
9244 g_signal_connect(G_OBJECT(gtkconv->close), "button-press-event",
18876
e4a4d7ab4bf0 The entries in the right-click menu on the tabs was getting cut off for me.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18864
diff changeset
9245 G_CALLBACK(close_conv_cb), gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9246
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9247 #if !GTK_CHECK_VERSION(2,6,0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9248 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9249 * I love Galeon. They have a fix for that stupid annoying visible
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9250 * border bug. I love you guys! -- ChipX86
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9251 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9252 /* This is fixed properly in some version of Gtk before 2.6.0 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9253 g_signal_connect(G_OBJECT(gtkconv->close), "state_changed",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9254 G_CALLBACK(tab_close_button_state_changed_cb), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9255 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9256
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9257 /* Status icon. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9258 gtkconv->icon = gtk_image_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9259 gtkconv->menu_icon = gtk_image_new();
19291
c003aa584909 Remove truncation until we can do it smarter
Sean Egan <seanegan@gmail.com>
parents: 19290
diff changeset
9260 gtk_widget_show(gtkconv->icon);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9261 update_tab_icon(conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9262
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9263 /* Tab label. */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9264 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
9265 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
9266
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9267 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
9268 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
9269 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
9270
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9271 gtk_widget_show_all(gtkconv->menu_icon);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9272
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9273 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
9274 gtk_widget_show(gtkconv->menu_label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9275 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
9276
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9277 gtk_widget_show(gtkconv->menu_tabby);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9278
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9279 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
9280 pidgin_conv_update_buddy_icon(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9281
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9282 /* Build and set conversations tab */
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9283 pidgin_conv_tab_pack(win, gtkconv);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9284
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9285 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
9286
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9287 gtk_widget_show(tab_cont);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9288
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9289 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
9290 /* 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
9291 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
9292 } else {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9293 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
9294 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9295
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9296 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
9297 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
9298 gtk_widget_grab_focus(focus_gtkconv->entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9299
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9300 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
9301 update_send_to_selection(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9302 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9303
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9304 static void
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9305 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
9306 {
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9307 gboolean tabs_side = FALSE;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9308 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
9309 GtkWidget *first, *third, *ebox;
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9310
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9311 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
9312 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
9313 tabs_side = TRUE;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9314 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
9315 angle = 90;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9316 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
9317 angle = 270;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9318
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9319 #if GTK_CHECK_VERSION(2,6,0)
19361
272d08484f7d remove obsolote GNOME color pallete
Sean Egan <seanegan@gmail.com>
parents: 19335
diff changeset
9320 if (!angle) {
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9321 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
9322 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
9323 } else {
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9324 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
9325 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
9326 }
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
9327
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9328 if (tabs_side) {
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9329 gtk_label_set_width_chars(
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9330 GTK_LABEL(gtkconv->tab_label),
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9331 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
9332 );
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9333 }
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
9334
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
9335 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
9336 #endif
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9337
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9338 #if 0
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9339 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
9340 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
9341 #endif
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9342
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9343 if (angle)
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9344 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
9345 else
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9346 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
9347 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
9348
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9349 /* select the correct ordering for verticle tabs */
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9350 if (angle == 90) {
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9351 first = gtkconv->close;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9352 third = gtkconv->icon;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9353 } else {
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9354 first = gtkconv->icon;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9355 third = gtkconv->close;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9356 }
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9357
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
9358 ebox = gtk_event_box_new();
17423
ae30f9913bb4 Fix for gtk < 2.4
Stu Tomlinson <stu@nosnilmot.com>
parents: 17294
diff changeset
9359 #if GTK_CHECK_VERSION(2,4,0)
17116
80350acaa289 Fix background color issues in the coversation tabs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17112
diff changeset
9360 gtk_event_box_set_visible_window(GTK_EVENT_BOX(ebox), FALSE);
17423
ae30f9913bb4 Fix for gtk < 2.4
Stu Tomlinson <stu@nosnilmot.com>
parents: 17294
diff changeset
9361 #endif
17106
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
9362 gtk_container_add(GTK_CONTAINER(ebox), gtkconv->tabby);
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
9363
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9364 if (gtkconv->tab_label->parent == NULL) {
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9365 /* Pack if it's a new widget */
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9366 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
9367 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
9368 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
9369
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9370 /* 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
9371 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
9372 } else {
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9373 /* reparent old widgets on preference changes */
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9374 gtk_widget_reparent(first, gtkconv->tabby);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9375 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
9376 gtk_widget_reparent(third, gtkconv->tabby);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9377 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
9378 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
9379 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
9380
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9381 /* 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
9382 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
9383 }
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9384
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
9385 gtk_notebook_set_tab_label_packing(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont,
19362
cbc08c427db6 Don't show tabs if tabs aren't turned on. Fixes #2669
Sean Egan <seanegan@gmail.com>
parents: 19361
diff changeset
9386 !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
9387 TRUE, GTK_PACK_START);
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9388
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
9389 if (pidgin_conv_window_get_gtkconv_count(win) == 1)
f85e3866bf93 Let's try this again. Tabs are not visible if there's only one conversation open
Sean Egan <seanegan@gmail.com>
parents: 18852
diff changeset
9390 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
9391 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
9392 (!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
9393 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
9394
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9395 /* 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
9396 /* gtk_widget_show(gtkconv->icon); */
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9397 gtk_widget_show(gtkconv->tab_label);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9398 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
9399 gtk_widget_show(gtkconv->close);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9400 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
9401 gtk_widget_show(ebox);
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9402 }
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9403
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9404 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9405 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
9406 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9407 unsigned int index;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9408 PurpleConversationType conv_type;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9409
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9410 conv_type = purple_conversation_get_type(gtkconv->active_conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9411 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
9412
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9413 g_object_ref(gtkconv->tab_cont);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9414 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
9415
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9416 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
9417
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9418 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
9419
19681
c35e8c057441 Fix a crash in window-placement.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19680
diff changeset
9420 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
9421 0, 0, NULL, NULL, gtkconv);
c35e8c057441 Fix a crash in window-placement.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19680
diff changeset
9422
18603
5610c2ea0d94 revert 'no visible tabs when only one conversation' as it proved unpopular. Made tabs only fill the entire width of the notebook when there's only one tab to avoid http://pidgin.im/~deryni/that_just_looks_dumb.png
Sean Egan <seanegan@gmail.com>
parents: 18602
diff changeset
9423 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
9424 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
9425
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9426 if (!win->gtkconvs && win != hidden_convwin)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9427 pidgin_conv_window_destroy(win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9428 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9429
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9430 PidginConversation *
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9431 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
9432 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9433 GtkWidget *tab_cont;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9434
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9435 if (index == -1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9436 index = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9437 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
9438 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
9439 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9440
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9441 PidginConversation *
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9442 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
9443 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9444 int index;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9445 GtkWidget *tab_cont;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9446
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9447 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
9448 if (index == -1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9449 index = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9450 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
9451 if (!tab_cont)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9452 return NULL;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9453 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
9454 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9455
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9456
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9457 PurpleConversation *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9458 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
9459 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9460 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9461
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9462 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
9463 return gtkconv ? gtkconv->active_conv : NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9464 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9465
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9466 gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9467 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
9468 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9469 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
9470 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9471
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9472 gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9473 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
9474 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9475 gboolean has_focus = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9476
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9477 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
9478
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9479 return has_focus;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9480 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9481
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9482 PidginWindow *
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9483 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
9484 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9485 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9486 GdkWindow *gdkwin;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9487 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9488
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9489 gdkwin = gdk_window_at_pointer(&x, &y);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9490
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9491 if (gdkwin)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9492 gdkwin = gdk_window_get_toplevel(gdkwin);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9493
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9494 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
9495 win = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9496
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9497 if (gdkwin == win->window->window)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9498 return 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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9501 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9502 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9503
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9504 GList *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9505 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
9506 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9507 return win->gtkconvs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9508 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9509
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9510 guint
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9511 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
9512 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9513 return g_list_length(win->gtkconvs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9514 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9515
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9516 PidginWindow *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9517 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
9518 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9519 GList *wins, *convs;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9520 PidginWindow *win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9521 PidginConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9522
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9523 if (type == PURPLE_CONV_TYPE_UNKNOWN)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9524 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9525
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9526 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
9527 win = wins->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9528
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9529 for (convs = win->gtkconvs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9530 convs != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9531 convs = convs->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9532
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9533 conv = convs->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9534
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9535 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
9536 return win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9537 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9538 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9539
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9540 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9541 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9542
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9543 PidginWindow *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9544 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
9545 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9546 GList *wins, *convs;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9547 PidginWindow *win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9548 PidginConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9549
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9550 if (type == PURPLE_CONV_TYPE_UNKNOWN)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9551 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9552
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9553 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
9554 wins != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9555 wins = wins->prev) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9556
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9557 win = wins->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9558
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9559 for (convs = win->gtkconvs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9560 convs != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9561 convs = convs->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9562
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9563 conv = convs->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9564
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9565 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
9566 return win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9567 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9568 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9569
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9570 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9571 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9572
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9573
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9574 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9575 * Conversation placement functions
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9576 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9577 typedef struct
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9578 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9579 char *id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9580 char *name;
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
9581 PidginConvPlacementFunc fnc;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9582
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9583 } ConvPlacementData;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9584
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9585 static GList *conv_placement_fncs = NULL;
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
9586 static PidginConvPlacementFunc place_conv = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9587
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9588 /* 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
9589 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9590 conv_placement_last_created_win(PidginConversation *conv)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9591 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9592 PidginWindow *win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9593
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9594 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
9595 win = l ? l->data : NULL;;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9596
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9597 if (win == NULL) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9598 win = pidgin_conv_window_new();
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9599
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9600 g_signal_connect(G_OBJECT(win->window), "configure_event",
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9601 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
9602
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9603 pidgin_conv_window_add_gtkconv(win, conv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9604 pidgin_conv_window_show(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9605 } else {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9606 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
9607 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9608 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9609
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9610 /* 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
9611 static gboolean
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9612 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
9613 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
9614 {
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9615 int x, y;
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9616 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
9617 GList *all;
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9618
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9619 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
9620 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
9621 else
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9622 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
9623
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9624 /* 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
9625 * 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
9626 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
9627 return FALSE;
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9628
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9629 /* 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
9630 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
9631 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
9632 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
9633 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
9634 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
9635
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9636 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
9637 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
9638 /* 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
9639 return FALSE;
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9640 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9641 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9642
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9643 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
9644 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
9645 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
9646 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
9647 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
9648 } 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
9649 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
9650 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
9651 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
9652 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
9653 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9654
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9655 return FALSE;
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9656 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9657
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9658 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9659 conv_placement_last_created_win_type(PidginConversation *conv)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9660 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9661 PidginWindow *win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9662
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9663 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
9664
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9665 if (win == NULL) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9666 win = pidgin_conv_window_new();
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9667
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9668 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
9669 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
9670 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
9671 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
9672 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
9673 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
9674 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
9675 } 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
9676 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
9677 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
9678 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
9679 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
9680 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
9681 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9682
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9683 pidgin_conv_window_add_gtkconv(win, conv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9684 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
9685
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9686 g_signal_connect(G_OBJECT(win->window), "configure_event",
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9687 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
9688 } else
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9689 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
9690 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9691
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9692 /* 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
9693 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9694 conv_placement_new_window(PidginConversation *conv)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9695 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9696 PidginWindow *win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9697
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9698 win = pidgin_conv_window_new();
18791
f36fc45b7866 really make restoring size and position work
Ka-Hing Cheung <khc@hxbc.us>
parents: 18790
diff changeset
9699
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9700 g_signal_connect(G_OBJECT(win->window), "configure_event",
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9701 G_CALLBACK(gtk_conv_configure_cb), NULL);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9702
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9703 pidgin_conv_window_add_gtkconv(win, conv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9704
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9705 pidgin_conv_window_show(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9706 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9707
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9708 static PurpleGroup *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9709 conv_get_group(PidginConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9710 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9711 PurpleGroup *group = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9712
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9713 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
9714 PurpleBuddy *buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9715
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9716 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
9717 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
9718
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9719 if (buddy != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9720 group = purple_buddy_get_group(buddy);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9721
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9722 } 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
9723 PurpleChat *chat;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9724
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9725 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
9726 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
9727
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9728 if (chat != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9729 group = purple_chat_get_group(chat);
15374
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 return group;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9733 }
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 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9736 * 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
9737 * 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
9738 * open windows will get a new window.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9739 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9740 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9741 conv_placement_by_group(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 PurpleConversationType type;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9744 PurpleGroup *group = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9745 GList *wl, *cl;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9746
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9747 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
9748
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9749 group = conv_get_group(conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9750
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9751 /* 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
9752 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
9753 PidginWindow *win2;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9754 PidginConversation *conv2;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9755 PurpleGroup *group2 = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9756
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9757 win2 = wl->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9758
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9759 for (cl = win2->gtkconvs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9760 cl != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9761 cl = cl->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9762 conv2 = cl->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9763
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9764 group2 = conv_get_group(conv2);
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 if (group == group2) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9767 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
9768
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9769 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9770 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9771 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9772 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9773
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9774 /* Make a new window. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9775 conv_placement_new_window(conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9776 }
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 /* 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
9779 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9780 conv_placement_by_account(PidginConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9781 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9782 PurpleConversationType type;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9783 GList *wins, *convs;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9784 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9785
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9786 account = purple_conversation_get_account(conv->active_conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9787 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
9788
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9789 /* 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
9790 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
9791 PidginWindow *win2;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9792 PidginConversation *conv2;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9793
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9794 win2 = wins->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9795
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9796 for (convs = win2->gtkconvs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9797 convs != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9798 convs = convs->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9799 conv2 = convs->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9800
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9801 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
9802 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
9803 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9804 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9805 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9806 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9807
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9808 /* Make a new window. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9809 conv_placement_new_window(conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9810 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9811
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9812 static ConvPlacementData *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9813 get_conv_placement_data(const char *id)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9814 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9815 ConvPlacementData *data = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9816 GList *n;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9817
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9818 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
9819 data = n->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9820 if (!strcmp(data->id, id))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9821 return data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9822 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9823
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9824 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9825 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9826
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9827 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9828 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
9829 PidginConvPlacementFunc fnc)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9830 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9831 ConvPlacementData *data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9832
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9833 data = g_new(ConvPlacementData, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9834
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9835 data->id = g_strdup(id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9836 data->name = g_strdup(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9837 data->fnc = fnc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9838
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9839 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
9840 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9841
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9842 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9843 ensure_default_funcs(void)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9844 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9845 if (conv_placement_fncs == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9846 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
9847 conv_placement_last_created_win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9848 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
9849 conv_placement_last_created_win_type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9850 add_conv_placement_fnc("new", _("New window"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9851 conv_placement_new_window);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9852 add_conv_placement_fnc("group", _("By group"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9853 conv_placement_by_group);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9854 add_conv_placement_fnc("account", _("By account"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9855 conv_placement_by_account);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9856 }
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9859 GList *
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9860 pidgin_conv_placement_get_options(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9861 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9862 GList *n, *list = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9863 ConvPlacementData *data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9864
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9865 ensure_default_funcs();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9866
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9867 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
9868 data = n->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9869 list = g_list_append(list, data->name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9870 list = g_list_append(list, data->id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9871 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9872
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9873 return list;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9874 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9875
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9876
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9877 void
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9878 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
9879 PidginConvPlacementFunc fnc)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9880 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9881 g_return_if_fail(id != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9882 g_return_if_fail(name != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9883 g_return_if_fail(fnc != NULL);
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 ensure_default_funcs();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9886
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9887 add_conv_placement_fnc(id, name, fnc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9888 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9889
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9890 void
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9891 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
9892 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9893 ConvPlacementData *data = get_conv_placement_data(id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9894
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9895 if (data == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9896 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9897
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9898 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
9899
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9900 g_free(data->id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9901 g_free(data->name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9902 g_free(data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9903 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9904
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9905 const char *
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9906 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
9907 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9908 ConvPlacementData *data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9909
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9910 ensure_default_funcs();
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 data = get_conv_placement_data(id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9913
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9914 if (data == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9915 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9916
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9917 return data->name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9918 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9919
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
9920 PidginConvPlacementFunc
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9921 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
9922 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9923 ConvPlacementData *data;
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 ensure_default_funcs();
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 data = get_conv_placement_data(id);
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 if (data == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9930 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9931
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9932 return data->fnc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9933 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9934
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9935 void
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
9936 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
9937 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9938 g_return_if_fail(func != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9939
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9940 /* 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
9941 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
9942 place_conv = func;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9943 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9944 place_conv = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9945 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9946
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
9947 PidginConvPlacementFunc
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9948 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
9949 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9950 return place_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9951 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9952
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9953 void
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9954 pidgin_conv_placement_place(PidginConversation *gtkconv)
15374
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 (place_conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9957 place_conv(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9958 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9959 conv_placement_new_window(gtkconv);
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 gboolean
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9963 pidgin_conv_is_hidden(PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9964 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9965 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
9966
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9967 return (gtkconv->win == hidden_convwin);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9968 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9969
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9970
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9971 /* 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
9972 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9973 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
9974 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9975 gulong fg_brightness;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9976 gulong bg_brightness;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9977 gulong br_diff;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9978 gulong col_diff;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9979 int fred, fgreen, fblue, bred, bgreen, bblue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9980
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9981 /* 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
9982 * 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
9983 * 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
9984 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9985
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9986 fred = foreground.red >> 8 ;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9987 fgreen = foreground.green >> 8 ;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9988 fblue = foreground.blue >> 8 ;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9989
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9990
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9991 bred = background.red >> 8 ;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9992 bgreen = background.green >> 8 ;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9993 bblue = background.blue >> 8 ;
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 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
9996 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
9997 br_diff = abs(fg_brightness - bg_brightness);
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 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
10000
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10001 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
10002 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10003
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10004
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10005 static GdkColor*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10006 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
10007 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10008 guint numcolors = *color_count;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10009 guint i = 0, j = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10010 GdkColor *colors = g_new(GdkColor, numcolors);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10011 GdkColor nick_highlight;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10012 GdkColor send_color;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10013 time_t breakout_time;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10014
21840
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
10015 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
10016 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
10017
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10018 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
10019
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10020 breakout_time = time(NULL) + 3;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10021
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10022 /* 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
10023 * 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
10024 * numcolors of them that do
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10025 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10026 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
10027 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10028 GdkColor color = nick_seed_colors[j];
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 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
10031 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
10032 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
10033 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10034 colors[i] = color;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10035 i++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10036 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10037 j++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10038 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10039
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10040 /* 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
10041 * 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
10042 * 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
10043 * conflict with each other.
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 while(i < numcolors && time(NULL) < breakout_time)
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 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
10048
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10049 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
10050 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
10051 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
10052 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10053 colors[i] = color;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10054 i++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10055 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10056 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10057
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10058 if (i < numcolors) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10059 GdkColor *c = colors;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
10060 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
10061 colors = g_memdup(c, i * sizeof(GdkColor));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10062 g_free(c);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10063 *color_count = i;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10066 return colors;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10067 }