annotate pidgin/gtkconv.c @ 22104:52d7368fdc1c

I'm gonna try adding in an easter egg here, see what people thing. See http://en.wikipedia.org/wiki/Xyzzy for a little background on xyzzy
author Mark Doliner <mark@kingant.net>
date Mon, 14 Jan 2008 06:20:53 +0000
parents 13d290879e0a
children 8f78d223d24e
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
21840
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
99 #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
100 #define DEFAULT_RECV_COLOR "#cc0000"
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_HIGHLIGHT_COLOR "#AF7F00"
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_ACTION_COLOR "#062585"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104 /* 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
105 #define DEBUG_CUSTOM_SMILEY
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 #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
108
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109 /* 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
110 #define MIN_BRIGHTNESS_CONTRAST 75
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 #define MIN_COLOR_CONTRAST 200
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113 #define NUM_NICK_COLORS 220
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 static GdkColor *nick_colors = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 static guint nbr_nick_colors;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117 typedef struct {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118 GtkWidget *window;
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 GtkWidget *entry;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121 GtkWidget *message;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
123 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125 } InviteBuddyInfo;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127 static GtkWidget *invite_dialog = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128 static GtkWidget *warn_close_dialog = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
130 static PidginWindow *hidden_convwin = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131 static GList *window_list = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
133 /* 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
134 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
135 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
136 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
137 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
138 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
139 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
140 static GList *offline_list = NULL;
15724
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
141 static GHashTable *prpl_lists = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
142
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
143 static gboolean update_send_to_selection(PidginWindow *win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
144 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
145
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
146 /* Prototypes. <-- because Paco-Paco hates this comment. */
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
147 static gboolean infopane_entry_activate(PidginConversation *gtkconv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
148 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
149 static void gray_stuff_out(PidginConversation *gtkconv);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
150 static GList *generate_invite_user_names(PurpleConnection *gc);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
151 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
152 static gboolean tab_complete(PurpleConversation *conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
153 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
154 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
155 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
156 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
157 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
158 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
159 gboolean pidgin_conv_has_focus(PurpleConversation *conv);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
160 static void pidgin_conv_custom_smiley_allocated(GdkPixbufLoader *loader, gpointer user_data);
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
161 static void pidgin_conv_custom_smiley_closed(GdkPixbufLoader *loader, gpointer user_data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
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);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
164 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
165 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
166 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
167 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
168 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
169
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
170 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
171 int width, int height);
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
172
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
173 static GdkColor *get_nick_color(PidginConversation *gtkconv, const char *name) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
174 static GdkColor col;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
175 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
176 float scale;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
177
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
178 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
179 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
180 (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
181
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182 /* 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
183 if (scale > 1) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184 col.red *= scale;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185 col.green *= scale;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186 col.blue *= scale;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
189 return &col;
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
19980
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
192 static PurpleBlistNode *
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
193 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
194 {
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
195 PurpleBlistNode *node = NULL;
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 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
198 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
199 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
200 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
201 break;
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
202 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
203 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
204 break;
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
205 default:
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 }
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
208 return node;
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
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
212 * Callbacks
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
18797
0622a7f08dde smaller close buttons on tabs. I think this looks really good.
Sean Egan <seanegan@gmail.com>
parents: 18796
diff changeset
215 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
216 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
217 {
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 PidginConversation *gtkconv = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219 GList *list = g_list_copy(gtkconv->convs);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
220 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
221 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
222 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
223 }
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
224
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 static gboolean
20077
fee0eea83e58 Honour the persistency when closing the window from the WM.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20051
diff changeset
226 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
227 {
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
228 /* 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
229 * 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
230 * (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
231 * 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
232 * 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
233 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
234 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
235 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
236
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 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
238 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
239 {
21664
c9946b9965c9 Kevin says we're ok defaulting persistent IMs on
Sean Egan <seanegan@gmail.com>
parents: 21661
diff changeset
240 hide_conv(gtkconv, TRUE);
21671
12b165b013e4 Fix a crash.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21665
diff changeset
241 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
242 }
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
243 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
244 {
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
245 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
246 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
247 !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
248 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
249 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
250 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
251 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
252 }
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 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
254 ;
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 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
256
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
257 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
258 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
259
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
260 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
261 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
262 {
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
263 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
264
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
265 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
267
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
268 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
269 default_formatize(PidginConversation *c)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
271 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
272 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
273 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
274
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
275 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
276 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
277 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
278 default_formatize(gtkconv);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
281 static const char *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
282 pidgin_get_cmd_prefix(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
283 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
284 return "/";
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
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
287 static PurpleCmdRet
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
288 say_command_cb(PurpleConversation *conv,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
289 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
290 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
291 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
292 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
293 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
294 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
295
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
296 return PURPLE_CMD_RET_OK;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
297 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
298
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
299 static PurpleCmdRet
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
300 me_command_cb(PurpleConversation *conv,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
301 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
302 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
303 char *tmp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
304
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
305 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
306
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
307 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
308 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
309 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
310 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
311
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
312 g_free(tmp);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
313 return PURPLE_CMD_RET_OK;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
314 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
315
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
316 static PurpleCmdRet
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
317 debug_command_cb(PurpleConversation *conv,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
318 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
319 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
320 char *tmp, *markup;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
321 PurpleCmdStatus status;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
322
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
323 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
324 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
325 markup = g_markup_escape_text(tmp, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
326
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
327 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
328
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
329 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
330 g_free(markup);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
331 return status;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
332 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
333 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
334 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
335 return PURPLE_CMD_STATUS_OK;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
336 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
337 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
338
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
339 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
340 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
341 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
342 GList *iter;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
343
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
344 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
345
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
346 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
347 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
348 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
349 }
65cd831b39cd Patch from jeff to add a 'clearall' command to clear all the scrollbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18263
diff changeset
350
65cd831b39cd Patch from jeff to add a 'clearall' command to clear all the scrollbacks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18263
diff changeset
351 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
352 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
353 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
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 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
356 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
357 }
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
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 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
360 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
361 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
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 purple_conversation_foreach(clear_conversation_scrollback);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
364 return PURPLE_CMD_STATUS_OK;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
365 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
366
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
367 static PurpleCmdRet
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
368 help_command_cb(PurpleConversation *conv,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
369 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
370 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
371 GList *l, *text;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
372 GString *s;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
374 if (args[0] != NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
375 s = g_string_new("");
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
376 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
377
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
378 if (text) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
379 for (l = text; l; l = l->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
380 if (l->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
381 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
382 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
383 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
384 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
385 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
386 }
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 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
389 "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
390
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
391 text = purple_cmd_list(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
392 for (l = text; l; l = l->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
393 if (l->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
394 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
395 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
396 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
397 g_list_free(text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
398 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
399
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
400 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
401 g_string_free(s, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
402
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
403 return PURPLE_CMD_STATUS_OK;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
404 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
405
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
406 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
407 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
408 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
409 GList *first;
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 first = g_list_first(gtkconv->send_history);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
412 g_free(first->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
413 first->data = g_strdup(message);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
414 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
415 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
416
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
417 static gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
418 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
419 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
420 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
421 char *cmd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
422 const char *prefix;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
423 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
424 gboolean retval = FALSE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
425
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
426 gtkconv = PIDGIN_CONVERSATION(conv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
427 prefix = pidgin_get_cmd_prefix();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
428
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
429 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
430 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
431
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
432 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
433 && !gtk_text_iter_get_child_anchor(&start)) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
434 PurpleCmdStatus status;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
435 char *error, *cmdline, *markup, *send_history;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
436 GtkTextIter end;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
437
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
438 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
439 send_history_add(gtkconv, send_history);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
440 g_free(send_history);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
441
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
442 cmdline = cmd + strlen(prefix);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
443
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
444 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
445 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
446 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
447 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
448 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
449 }
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
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
451 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
452 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
453 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
454 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
455 g_free(markup);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
456
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
457 switch (status) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
458 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
459 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
460 break;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
461 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
462 {
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
463 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
464 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
465
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
466 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
467 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
468
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
469 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
470 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
471 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
472
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
473 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
474 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
475 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
476 } else {
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
477 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
478 }
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
479
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
480 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
481 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
482 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
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 break;
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
486 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
487 case PURPLE_CMD_STATUS_WRONG_ARGS:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
488 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
489 "to that command."),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
490 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
491 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
492 break;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
493 case PURPLE_CMD_STATUS_FAILED:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
494 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
495 PURPLE_MESSAGE_NO_LOG, time(NULL));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
496 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
497 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
498 break;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
499 case PURPLE_CMD_STATUS_WRONG_TYPE:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
500 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
501 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
502 PURPLE_MESSAGE_NO_LOG, time(NULL));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
503 else
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
504 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
505 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
506 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
507 break;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
508 case PURPLE_CMD_STATUS_WRONG_PRPL:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
509 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
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;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
513 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
514 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
515
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
516 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
517 return retval;
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 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
521 send_cb(GtkWidget *widget, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
522 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
523 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
524 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
525 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
526 PurpleMessageFlags flags = 0;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
527 char *buf, *clean;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
528
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
529 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
530
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
531 if (check_for_and_do_command(conv)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
532 if (gtkconv->entry_growing) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
533 gtkconv->entry_growing = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
534 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
535 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
536 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
537 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
538
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
539 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
540 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
541 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
542
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 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
544 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
545
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
546 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
547 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
548
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
549 gtk_widget_grab_focus(gtkconv->entry);
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 if (strlen(clean) == 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
552 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
553 g_free(clean);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
554 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
555 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
556
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
557 purple_idle_touch();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
558
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
559 /* 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
560 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
561 flags |= PURPLE_MESSAGE_IMAGES;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
562
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
563 gc = purple_account_get_connection(account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
564 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
565 char **bufs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
566 int i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
567
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
568 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
569 for (i = 0; bufs[i]; i++) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
570 send_history_add(gtkconv, bufs[i]);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
571 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
572 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
573 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
574 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
575 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
576
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
577 g_strfreev(bufs);
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 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
580 send_history_add(gtkconv, buf);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
581 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
582 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
583 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
584 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
585 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
586
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
587 g_free(clean);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
588 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
589
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
590 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
591 if (gtkconv->entry_growing) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
592 gtkconv->entry_growing = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
593 }
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
594 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
595 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
596
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
597 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
598 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
599 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
600 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
601 const char *name;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
602 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
603
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
604 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
605 name = purple_conversation_get_name(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
606
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
607 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
608 PurpleBuddy *b;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
609
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
610 b = purple_find_buddy(account, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
611 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
612 pidgin_dialogs_remove_buddy(b);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
613 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
614 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
615 } 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
616 PurpleChat *c;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
617
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
618 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
619 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
620 pidgin_dialogs_remove_chat(c);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
621 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
622 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
623 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
624
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
625 gtk_widget_grab_focus(PIDGIN_CONVERSATION(conv)->entry);
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
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
628 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
629 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
630 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
631 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
632
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
633 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
634 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
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
639 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
640 info_cb(GtkWidget *widget, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
641 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
642 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
643
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
644 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
645 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
646 purple_conversation_get_name(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
647 gtk_widget_grab_focus(gtkconv->entry);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
648 } 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
649 /* 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
650 PidginChatPane *gtkchat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
651 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
652 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
653 GtkTreeSelection *sel;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
654 char *name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
655
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
656 gtkchat = gtkconv->u.chat;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
657
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
658 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
659 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
660
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
661 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
662 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
663 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
664 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
665
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
666 chat_do_info(gtkconv, name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
667 g_free(name);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
671 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
672 block_cb(GtkWidget *widget, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
673 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
674 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
675 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
676
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
677 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
678
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
679 if (account != NULL && purple_account_is_connected(account))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
680 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
681
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
682 gtk_widget_grab_focus(PIDGIN_CONVERSATION(conv)->entry);
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
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
685 static void
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
686 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
687 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
688 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
689 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
690
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
691 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
692
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
693 if (account != NULL && purple_account_is_connected(account))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
694 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
695
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
696 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
697 }
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
698
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
699 static void
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
700 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
701 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
702 const char *buddy, *message;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
703 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
704
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
705 gtkconv = PIDGIN_CONVERSATION(info->conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
706
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
707 if (resp == GTK_RESPONSE_OK) {
20028
a2b4eac83902 Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19980
diff changeset
708 buddy = pidgin_text_combo_box_entry_get_text(info->entry);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
709 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
710
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
711 if (!g_ascii_strcasecmp(buddy, ""))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
712 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
713
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
714 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
715 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
716 message, buddy);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
717 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
718
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
719 gtk_widget_destroy(invite_dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
720 invite_dialog = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
721
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
722 g_free(info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
723 }
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 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
726 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
727 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
728 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
729 InviteBuddyInfo *info = (InviteBuddyInfo *)data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
730 const char *convprotocol;
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 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
733
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
734 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
735 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
736 PurpleBlistNode *node = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
737 PurpleBuddy *buddy;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
738
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
739 memcpy(&node, sd->data, sizeof(node));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
740
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
741 if (PURPLE_BLIST_NODE_IS_CONTACT(node))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
742 buddy = purple_contact_get_priority_buddy((PurpleContact *)node);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
743 else if (PURPLE_BLIST_NODE_IS_BUDDY(node))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
744 buddy = (PurpleBuddy *)node;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
745 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
746 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
747
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
748 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
749 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
750 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
751 _("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
752 "chat."), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
753 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
754 else
20028
a2b4eac83902 Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19980
diff changeset
755 pidgin_text_combo_box_entry_set_text(info->entry, buddy->name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
756
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
757 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
758 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
759 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
760 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
761 char *protocol = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
762 char *username = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
763 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
764
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
765 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
766 &protocol, &username, NULL))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
767 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
768 if (account == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
769 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
770 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
771 _("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
772 "can invite that buddy."), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
773 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
774 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
775 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
776 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
777 _("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
778 "chat."), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
779 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
780 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
781 {
20028
a2b4eac83902 Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19980
diff changeset
782 pidgin_text_combo_box_entry_set_text(info->entry, username);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
783 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
784 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
785
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
786 g_free(username);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
787 g_free(protocol);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
788
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
789 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
790 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
791 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
792
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
793 static const GtkTargetEntry dnd_targets[] =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
794 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
795 {"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
796 {"application/x-im-contact", 0, 1}
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
797 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
798
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
799 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
800 invite_cb(GtkWidget *widget, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
801 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
802 PurpleConversation *conv = gtkconv->active_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
803 InviteBuddyInfo *info = NULL;
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 if (invite_dialog == NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
806 PurpleConnection *gc;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
807 PidginWindow *gtkwin;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
808 GtkWidget *label;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
809 GtkWidget *vbox, *hbox;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
810 GtkWidget *table;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
811 GtkWidget *img;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
812
15436
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15435
diff changeset
813 img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_QUESTION,
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15435
diff changeset
814 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
815
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
816 info = g_new0(InviteBuddyInfo, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
817 info->conv = conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
818
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
819 gc = purple_conversation_get_gc(conv);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
820 gtkwin = pidgin_conv_get_window(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
821
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
822 /* Create the new dialog. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
823 invite_dialog = gtk_dialog_new_with_buttons(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
824 _("Invite Buddy Into Chat Room"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
825 GTK_WINDOW(gtkwin->window), 0,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
826 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
15509
23ca11f8a8c4 stock to pidgin
Sean Egan <seanegan@gmail.com>
parents: 15508
diff changeset
827 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
828
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
829 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
830 GTK_RESPONSE_OK);
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
831 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
832 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
833 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
834
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
835 info->window = GTK_WIDGET(invite_dialog);
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 /* Setup the outside spacing. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
838 vbox = GTK_DIALOG(invite_dialog)->vbox;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
839
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
840 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
841 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
842
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
843 /* 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
844 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
845 gtk_container_add(GTK_CONTAINER(vbox), hbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
846 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
847 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
848
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
849 /* Setup the right vbox. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
850 vbox = gtk_vbox_new(FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
851 gtk_container_add(GTK_CONTAINER(hbox), vbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
852
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
853 /* Put our happy label in it. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
854 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
855 "to invite, along with an optional invite "
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
856 "message."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
857 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
858 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
859 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
860 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
861
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
862 /* 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
863 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
864 gtk_container_add(GTK_CONTAINER(vbox), hbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
865
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
866 /* 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
867 table = gtk_table_new(2, 2, FALSE);
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
868 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
869 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
870 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
871 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
872
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
873 /* Now the Buddy label */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
874 label = gtk_label_new(NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
875 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
876 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
877 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
878
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
879 /* Now the Buddy drop-down entry field. */
20028
a2b4eac83902 Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19980
diff changeset
880 info->entry = pidgin_text_combo_box_entry_new(NULL, generate_invite_user_names(gc));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
881 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
882 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
883
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
884 /* Now the label for "Message" */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
885 label = gtk_label_new(NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
886 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
887 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
888 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
889
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
890
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
891 /* And finally, the Message entry field. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
892 info->message = gtk_entry_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
893 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
894
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
895 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
896 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
897
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
898 /* Connect the signals. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
899 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
900 G_CALLBACK(do_invite), info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
901 /* Setup drag-and-drop */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
902 gtk_drag_dest_set(info->window,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
903 GTK_DEST_DEFAULT_MOTION |
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
904 GTK_DEST_DEFAULT_DROP,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
905 dnd_targets,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
906 sizeof(dnd_targets) / sizeof(GtkTargetEntry),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
907 GDK_ACTION_COPY);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
908 gtk_drag_dest_set(info->entry,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
909 GTK_DEST_DEFAULT_MOTION |
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
910 GTK_DEST_DEFAULT_DROP,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
911 dnd_targets,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
912 sizeof(dnd_targets) / sizeof(GtkTargetEntry),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
913 GDK_ACTION_COPY);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
914
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
915 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
916 G_CALLBACK(invite_dnd_recv), info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
917 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
918 G_CALLBACK(invite_dnd_recv), info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
919
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
920 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
921
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
922 gtk_widget_show_all(invite_dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
923
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
924 if (info != NULL)
20028
a2b4eac83902 Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19980
diff changeset
925 gtk_widget_grab_focus(GTK_BIN(info->entry)->child);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
926 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
927
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
928 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
929 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
930 {
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
931 pidgin_dialogs_im();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
932 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
933
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
934 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
935 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
936 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
937 PurpleConversation *conv = (PurpleConversation *)user_data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
938 FILE *fp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
939 const char *name;
19665
37429bc82307 I think this fixes #2858.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19655
diff changeset
940 char **lines;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
941 gchar *text;
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 if ((fp = g_fopen(filename, "w+")) == NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
944 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
945 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
946 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
947
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
948 name = purple_conversation_get_name(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
949 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
950 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
951
19665
37429bc82307 I think this fixes #2858.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19655
diff changeset
952 lines = gtk_imhtml_get_markup_lines(
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
953 GTK_IMHTML(PIDGIN_CONVERSATION(conv)->imhtml));
19667
a2f5a28ba983 More fix, thanks to SimGuy.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19665
diff changeset
954 text = g_strjoinv("<br>\n", lines);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
955 fprintf(fp, "%s", text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
956 g_free(text);
19665
37429bc82307 I think this fixes #2858.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19655
diff changeset
957 g_strfreev(lines);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
958
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
959 fprintf(fp, "\n</body>\n</html>\n");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
960 fclose(fp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
961 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
962
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
963 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
964 * 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
965 * plaintext v. HTML file.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
966 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
967 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
968 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
969 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
970 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
971 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
972 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
973 const char *name;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
974 gchar *buf;
17195
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
975 gchar *c;
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
976
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
977 if (buddy != NULL)
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
978 name = purple_buddy_get_contact_alias(buddy);
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
979 else
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
980 name = purple_normalize(conv->account, conv->name);
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
981
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
982 buf = g_strdup_printf("%s.html", name);
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
983 for (c = buf ; *c ; c++)
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
984 {
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
985 if (*c == '/' || *c == '\\')
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
986 *c = ' ';
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
987 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
988 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
989 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
990 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
991 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
992 conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
993
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
994 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
995 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
996
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
997 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
998 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
999 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1000 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1001 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1002 PurpleLogType type;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1003 PidginBuddyList *gtkblist;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1004 GdkCursor *cursor;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1005 const char *name;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1006 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1007 GSList *buddies;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1008 GSList *cur;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1009
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1010 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
1011
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1012 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
1013 type = PURPLE_LOG_IM;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1014 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
1015 type = PURPLE_LOG_CHAT;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1016 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1017 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1018
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1019 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
1020
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1021 cursor = gdk_cursor_new(GDK_WATCH);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1022 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
1023 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
1024 gdk_cursor_unref(cursor);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1025 #if GTK_CHECK_VERSION(2,4,0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1026 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
1027 #else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1028 gdk_flush();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1029 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1030
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1031 name = purple_conversation_get_name(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1032 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1033
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1034 buddies = purple_find_buddies(account, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1035 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
1036 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1037 PurpleBlistNode *node = cur->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1038 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
1039 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1040 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
1041 g_slist_free(buddies);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1042 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
1043 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
1044 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1045 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1046 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1047 g_slist_free(buddies);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1048
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1049 pidgin_log_show(type, name, account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1050
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1051 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
1052 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
1053 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1054
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1055 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1056 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
1057 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1058 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1059 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1060
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1061 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
1062 clear_conversation_scrollback(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1063 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1064
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1065 struct _search {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1066 PidginWindow *gtkwin;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1067 GtkWidget *entry;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1070 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
1071 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1072 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1073 PidginConversation *gtk_active_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1074 GList *iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1075
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1076 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
1077 gtk_active_conv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1078
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1079 switch (resp)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1080 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1081 case GTK_RESPONSE_OK:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1082 /* clear highlighting except the active conversation window
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1083 * 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
1084 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
1085 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1086 PidginConversation *gtkconv = iter->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1087
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1088 if (gtkconv != gtk_active_conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1089 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1090 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
1091 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1092 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1093 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1094 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
1095 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
1096 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1097 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1098 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1099
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1100 case GTK_RESPONSE_DELETE_EVENT:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1101 case GTK_RESPONSE_CLOSE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1102 /* 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
1103 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
1104 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1105 PidginConversation *gconv = iter->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1106 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
1107 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1108
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1109 gtk_widget_destroy(s->gtkwin->dialogs.search);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1110 s->gtkwin->dialogs.search = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1111 g_free(s);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1112 break;
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 }
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 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1117 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
1118 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1119 PidginWindow *gtkwin = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1120 GtkWidget *hbox;
15436
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15435
diff changeset
1121 GtkWidget *img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_QUESTION,
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15435
diff changeset
1122 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
1123 GtkWidget *label;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1124 struct _search *s;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1125
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1126 if (gtkwin->dialogs.search) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1127 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
1128 return;
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 s = g_malloc(sizeof(struct _search));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1132 s->gtkwin = gtkwin;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1133
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1134 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
1135 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
1136 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1137 GTK_STOCK_FIND, GTK_RESPONSE_OK, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1138 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
1139 GTK_RESPONSE_OK);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1140 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
1141 G_CALLBACK(do_search_cb), s);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1142
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
1143 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
1144 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
1145 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
1146 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
1147 gtk_container_set_border_width(
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
1148 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
1149
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
1150 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
1151 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
1152 hbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1153 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
1154
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1155 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
1156 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
1157 GTK_RESPONSE_OK, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1158
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1159 label = gtk_label_new(NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1160 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
1161 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
1162
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1163 s->entry = gtk_entry_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1164 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
1165 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
1166 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
1167 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
1168 gtkwin->dialogs.search);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1169 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
1170
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1171 gtk_widget_show_all(gtkwin->dialogs.search);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1172 gtk_widget_grab_focus(s->entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1173 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1174
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1175 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1176 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
1177 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1178 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1179 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
1180
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1181 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
1182 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
1183 }
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1186
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1187 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1188 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
1189 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1190 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1191 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1192
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1193 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
1194
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1195 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
1196 purple_conversation_get_name(conv), NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1197 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1198
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1199 static void
17776
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1200 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
1201 {
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1202 PidginWindow *win = data;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1203 PidginConversation *gtkconv;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1204 GtkIMHtmlToolbar *toolbar;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1205
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1206 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
1207 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar);
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1208
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1209 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
1210 !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
1211 }
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1212
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1213 static void
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1214 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
1215 {
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1216 PidginWindow *win = data;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1217 PurpleConversation *conv;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1218 PidginConversation *gtkconv;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1219 GtkIMHtmlToolbar *toolbar;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1220
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1221 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
1222 conv = gtkconv->active_conv;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1223 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar);
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1224
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1225 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
1226 !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
1227 }
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1228
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1229
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1230 static void
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1231 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
1232 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1233 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1234 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1235 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1236 const char *name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1237
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1238 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
1239 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1240 name = purple_conversation_get_name(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1241
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1242 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
1243 PurpleBuddy *b;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1244
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1245 b = purple_find_buddy(account, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1246 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
1247 pidgin_dialogs_alias_buddy(b);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1248 } 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
1249 PurpleChat *c;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1250
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1251 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
1252 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
1253 pidgin_dialogs_alias_chat(c);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1254 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1255 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1256
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1257 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1258 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
1259 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1260 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1261 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1262
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1263 conv = pidgin_conv_window_get_active_conversation(win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1264
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1265 info_cb(NULL, PIDGIN_CONVERSATION(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1266 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1267
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1268 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1269 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
1270 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1271 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1272 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1273
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1274 conv = pidgin_conv_window_get_active_conversation(win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1275
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1276 invite_cb(NULL, PIDGIN_CONVERSATION(conv));
15374
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_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
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 block_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
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
1291 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
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;
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
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 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
1299 }
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
1300
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
1301 static void
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1302 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
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 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
1310 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1311
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
1312 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
1313 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
1314 {
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1315 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
1316 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
1317 }
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1318
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1319 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
1320 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
1321 {
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1322 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
1323
19556
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
1324 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
1325 "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
1326
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1327 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
1328 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
1329 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
1330 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
1331 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
1332 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
1333 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
1334 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
1335 }
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
1336 #if 0
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
1337 /* 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
1338 purple_conversation_set_ui_ops(conv, NULL);
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
1339 #else
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
1340 pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv);
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
1341 pidgin_conv_window_add_gtkconv(hidden_convwin, gtkconv);
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
1342 #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
1343 }
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
1344 }
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
1345
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
1346 static void
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1347 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
1348 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1349 PidginWindow *win = data;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1350
18797
0622a7f08dde smaller close buttons on tabs. I think this looks really good.
Sean Egan <seanegan@gmail.com>
parents: 18796
diff changeset
1351 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
1352 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1353
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1354 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1355 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
1356 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1357 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1358 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1359 gboolean logging;
22009
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1360 PurpleBlistNode *node;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1361
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1362 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
1363
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1364 if (conv == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1365 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1366
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1367 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
1368
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1369 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
1370 return;
22009
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1371
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1372 node = get_conversation_blist_node(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1374 if (logging)
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 /* 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
1377 purple_conversation_set_logging(conv, TRUE);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1378
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1379 purple_conversation_write(conv, NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1380 _("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
1381 conv->logs ? (PURPLE_MESSAGE_SYSTEM) :
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1382 (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
1383 time(NULL));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1384 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1385 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1386 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1387 purple_conversation_write(conv, NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1388 _("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
1389 conv->logs ? (PURPLE_MESSAGE_SYSTEM) :
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1390 (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
1391 time(NULL));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1392
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1393 /* 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
1394 purple_conversation_set_logging(conv, FALSE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1395 }
22009
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1396
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1397 /* 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
1398 switch (conv->type)
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1399 {
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1400 case PURPLE_CONV_TYPE_IM:
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1401 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
1402 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
1403 else
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1404 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
1405 break;
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1406
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1407 case PURPLE_CONV_TYPE_CHAT:
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1408 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
1409 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
1410 else
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1411 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
1412 break;
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1413
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1414 default:
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1415 break;
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
1416 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1417 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1418
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1419 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1420 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
1421 {
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
1422 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
1423 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
1424 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1425
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1426 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1427 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
1428 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1429 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1430 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1431 PidginConversation *gtkconv;
19980
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
1432 PurpleBlistNode *node;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1433
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1434 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
1435
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1436 if (!conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1437 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1438
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1439 gtkconv = PIDGIN_CONVERSATION(conv);
15374
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 gtkconv->make_sound =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1442 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
1443 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
1444 if (node)
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
1445 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
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_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
1450 {
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
1451 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
1452 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
1453 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1454
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1455 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1456 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
1457 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1458 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1459 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1460 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1461 PurplePluginProtocolInfo *prpl_info = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1462 char *real_who;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1463
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1464 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1465 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1466
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1467 gc = purple_account_get_connection(account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1468 g_return_if_fail(gc != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1469
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1470 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
1471
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1472 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
1473 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
1474 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
1475 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1476 real_who = g_strdup(who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1477
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1478 if(!real_who)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1479 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1480
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
1481 pidgin_dialogs_im_with_user(account, real_who);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1482
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1483 g_free(real_who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1484 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1485
16286
3974d12a56ec Fix ignore in chats when using right-click on a nick in the conversation
Stu Tomlinson <stu@nosnilmot.com>
parents: 16273
diff changeset
1486 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
1487
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1488 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1489 ignore_cb(GtkWidget *w, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1490 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1491 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1492 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
1493 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
1494
3974d12a56ec Fix ignore in chats when using right-click on a nick in the conversation
Stu Tomlinson <stu@nosnilmot.com>
parents: 16273
diff changeset
1495 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
1496 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
1497
3974d12a56ec Fix ignore in chats when using right-click on a nick in the conversation
Stu Tomlinson <stu@nosnilmot.com>
parents: 16273
diff changeset
1498 if (name == NULL)
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
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1501 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
1502 purple_conv_chat_unignore(chat, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1503 else
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1504 purple_conv_chat_ignore(chat, name);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
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 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
1507 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1508
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1509 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1510 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
1511 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1512 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
1513
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1514 chat_do_im(gtkconv, who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1515 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1516
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1517 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1518 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
1519 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1520 PurpleConversation *conv = gtkconv->active_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1521 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
1522 PurpleConnection *gc = purple_conversation_get_gc(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1523
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1524 serv_send_file(gc, who, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1525 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1526
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1527 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1528 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
1529 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1530 char *who;
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 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_info(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_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
1539 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1540 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1541 PurplePluginProtocolInfo *prpl_info = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1542 PurpleConnection *gc;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1543 char *who;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1544
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1545 gc = purple_conversation_get_gc(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1546 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
1547
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1548 if (gc != NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1549 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
1550
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1551 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1552 * 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
1553 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1554
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1555 if (prpl_info->get_cb_away != NULL)
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 prpl_info->get_cb_away(gc,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1558 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
1559 }
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 }
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 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1564 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
1565 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1566 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1567 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1568 PurpleBuddy *b;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1569 char *name;
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 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1572 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
1573 b = purple_find_buddy(account, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1574
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1575 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
1576 pidgin_dialogs_remove_buddy(b);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1577 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
1578 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
1579
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1580 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
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 static GtkTextMark *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1584 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
1585 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1586 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
1587 char *tmp = g_strconcat("user:", who, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1588 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
1589
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1590 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1591 return mark;
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_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
1596 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1597 GtkTextMark *mark;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1598 const char *who;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1599
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1600 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
1601 mark = get_mark_for_user(gtkconv, who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1602
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1603 if (mark != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1604 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
1605 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1606 g_return_if_reached();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1607 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1608
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1609 static GtkWidget *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1610 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
1611 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1612 static GtkWidget *menu = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1613 PurplePluginProtocolInfo *prpl_info = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1614 PurpleConvChat *chat = PURPLE_CONV_CHAT(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1615 gboolean is_me = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1616 GtkWidget *button;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1617 PurpleBuddy *buddy = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1618
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1619 if (gc != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1620 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
1621
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1622 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1623 * 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
1624 * thus freeing-up the memory it occupied.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1625 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1626 if (menu)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1627 gtk_widget_destroy(menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1628
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1629 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
1630 is_me = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1631
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1632 menu = gtk_menu_new();
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 (!is_me) {
15560
442128853bdb toolbar/menu icons. reduce the imhtmltoolbar spacing. more gaimstock pruning
Sean Egan <seanegan@gmail.com>
parents: 15557
diff changeset
1635 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
1636 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
1637
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1638 if (gc == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1639 gtk_widget_set_sensitive(button, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1640
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1641 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1642
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1643
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1644 if (prpl_info && prpl_info->send_file)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1645 {
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
1646 button = pidgin_new_item_from_stock(menu, _("Send File"),
16839
d6ccf170148e New Send File icon
Hylke Bons <hylkebons@gmail.com>
parents: 16809
diff changeset
1647 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
1648 PIDGIN_CONVERSATION(conv), 0, 0, 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 || prpl_info == NULL ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1651 !(!prpl_info->can_receive_file || prpl_info->can_receive_file(gc, who)))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1652 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1653 gtk_widget_set_sensitive(button, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1654 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1655
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1656 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1657 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1658
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 (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
1661 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
1662 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
1663 else
15509
23ca11f8a8c4 stock to pidgin
Sean Egan <seanegan@gmail.com>
parents: 15508
diff changeset
1664 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
1665 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
1666
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1667 if (gc == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1668 gtk_widget_set_sensitive(button, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1669
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1670 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1671 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1672
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1673 if (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
1674 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
1675 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
1676
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1677 if (gc == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1678 gtk_widget_set_sensitive(button, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1679
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1680 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1681 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1682
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1683 if (prpl_info && prpl_info->get_cb_away) {
15509
23ca11f8a8c4 stock to pidgin
Sean Egan <seanegan@gmail.com>
parents: 15508
diff changeset
1684 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
1685 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
1686
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1687 if (gc == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1688 gtk_widget_set_sensitive(button, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1689
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1690 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1691 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1692
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1693 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
1694 if ((buddy = purple_find_buddy(conv->account, who)) != NULL)
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
1695 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
1696 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
1697 else
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
1698 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
1699 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
1700
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1701 if (gc == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1702 gtk_widget_set_sensitive(button, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1703
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1704 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1705 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1706
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
1707 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
1708 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
1709 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
1710 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
1711 gtk_widget_set_sensitive(button, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1712
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1713 if (buddy != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1714 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1715 if (purple_account_is_connected(conv->account))
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1716 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
1717 (PurpleBlistNode *)buddy);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1718 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
1719 gtk_widget_show_all(menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1720 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1721
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1722 return menu;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1726 static gint
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1727 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
1728 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1729 PurpleConversation *conv = gtkconv->active_conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1730 PidginChatPane *gtkchat;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1731 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1732 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1733 GtkTreeSelection *sel;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1734 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1735 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1736 GtkWidget *menu;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1737 gchar *who;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1738
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1739 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1740 gtkchat = gtkconv->u.chat;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1741 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1742 gc = account->gc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1743
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1744 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
1745
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1746 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
1747 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
1748 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1749
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1750 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
1751 menu = create_chat_menu (conv, who, gc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1752 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
1753 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
1754 0, GDK_CURRENT_TIME);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1755 g_free(who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1756
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1757 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1758 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1759
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1760
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1761 static gint
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1762 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
1763 PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1764 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1765 PurpleConversation *conv = gtkconv->active_conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1766 PidginChatPane *gtkchat;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1767 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1768 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1769 GtkTreePath *path;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1770 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1771 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1772 GtkTreeViewColumn *column;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1773 gchar *who;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1774 int x, y;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1775
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1776 gtkchat = gtkconv->u.chat;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1777 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1778 gc = account->gc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1779
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1780 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
1781
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1782 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
1783 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
1784
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1785 if (path == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1786 return FALSE;
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 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
1789 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
1790 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
1791 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
1792 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
1793
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1794 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
1795 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
1796
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1797 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
1798 chat_do_im(gtkconv, who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1799 } 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
1800 /* Move to user's anchor */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1801 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
1802
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1803 if(mark != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1804 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
1805 } 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
1806 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
1807 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
1808 event->button, event->time);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1809 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1810
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1811 g_free(who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1812 gtk_tree_path_free(path);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1813
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1814 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1815 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1816
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1817 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1818 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
1819 {
17141
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1820 PidginConversation *next_gtkconv = NULL, *most_active = NULL;
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1821 PidginUnseenState unseen_state = PIDGIN_UNSEEN_NONE;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1822 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1823 int initial, i, total, diff;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1824
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1825 win = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1826 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
1827 gtkconv->tab_cont);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1828 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
1829 /* 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
1830 * 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
1831 * positive number.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1832 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1833 diff = (forward ? 1 : -1) + total;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1834
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1835 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
1836 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
1837 if (next_gtkconv->unseen_state > unseen_state) {
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1838 most_active = next_gtkconv;
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1839 unseen_state = most_active->unseen_state;
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1840 if(PIDGIN_UNSEEN_NICK == unseen_state) /* highest possible state */
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1841 break;
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1842 }
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1843 }
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1844
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1845 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
1846 i = (i + diff) % total;
17141
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1847 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
1848 }
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1849
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1850 if (most_active != NULL && most_active != gtkconv)
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1851 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
1852 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1853
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1854 static gboolean
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1855 conv_keypress_common(PidginConversation *gtkconv, GdkEventKey *event)
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1856 {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1857 PidginWindow *win;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1858 PurpleConversation *conv;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1859 int curconv;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1860
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1861 conv = gtkconv->active_conv;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1862 win = gtkconv->win;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1863 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
1864
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1865 /* If CTRL was held down... */
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1866 if (event->state & GDK_CONTROL_MASK) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1867 switch (event->keyval) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1868 case GDK_Page_Down:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1869 case ']':
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1870 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
1871 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
1872 else
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1873 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
1874 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1875 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1876
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1877 case GDK_Page_Up:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1878 case '[':
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1879 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
1880 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
1881 else
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1882 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
1883 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1884 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1885
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1886 case GDK_Tab:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1887 case GDK_ISO_Left_Tab:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1888 if (event->state & GDK_SHIFT_MASK) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1889 move_to_next_unread_tab(gtkconv, FALSE);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1890 } else {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1891 move_to_next_unread_tab(gtkconv, TRUE);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1892 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1893
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1894 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1895 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1896
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1897 case GDK_comma:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1898 gtk_notebook_reorder_child(GTK_NOTEBOOK(win->notebook),
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1899 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
1900 curconv - 1);
20190
da6a1320d3e1 applied changes from f4700a52b60d8473e9671ceabfec7772211fe424
Richard Laager <rlaager@wiktel.com>
parents: 20183
diff changeset
1901 return TRUE;
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1902 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1903
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1904 case GDK_period:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1905 gtk_notebook_reorder_child(GTK_NOTEBOOK(win->notebook),
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1906 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
1907 #if GTK_CHECK_VERSION(2,2,0)
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1908 (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
1909 #else
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1910 (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
1911 #endif
20190
da6a1320d3e1 applied changes from f4700a52b60d8473e9671ceabfec7772211fe424
Richard Laager <rlaager@wiktel.com>
parents: 20183
diff changeset
1912 return TRUE;
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1913 break;
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 } /* End of switch */
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1916 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1917
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1918 /* If ALT (or whatever) was held down... */
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1919 else if (event->state & GDK_MOD1_MASK)
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1920 {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1921 if (event->keyval > '0' && event->keyval <= '9')
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 guint switchto = event->keyval - '1';
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1924 if (switchto < pidgin_conv_window_get_gtkconv_count(win))
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1925 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), switchto);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1926
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1927 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1928 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1929 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1930
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1931 /* If neither CTRL nor ALT were held down... */
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1932 else
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1933 {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1934 switch (event->keyval) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1935 case GDK_F2:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1936 if (gtk_widget_is_focus(GTK_WIDGET(win->notebook))) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1937 infopane_entry_activate(gtkconv);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1938 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1939 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1940 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1941 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1942 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1943 return FALSE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1944 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1945
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1946 static gboolean
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1947 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
1948 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1949 PidginWindow *win;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1950 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1951 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1952
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1953 gtkconv = (PidginConversation *)data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1954 conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1955 win = gtkconv->win;
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1956
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1957 if (conv_keypress_common(gtkconv, event))
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1958 return TRUE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1959
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1960 /* If CTRL was held down... */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1961 if (event->state & GDK_CONTROL_MASK) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1962 switch (event->keyval) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1963 case GDK_Up:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1964 if (!gtkconv->send_history)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1965 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1966
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
1967 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
1968 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
1969
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1970 if (!gtkconv->send_history->prev) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1971 GtkTextIter start, end;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1972
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1973 g_free(gtkconv->send_history->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1974
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1975 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
1976 &start);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1977 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
1978
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1979 gtkconv->send_history->data =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1980 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
1981 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1982
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1983 if (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
1984 GObject *object;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1985 GtkTextIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1986 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
1987
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1988 gtkconv->send_history = gtkconv->send_history->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1989
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1990 /* 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
1991 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
1992 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
1993 NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1994 /* Clear the formatting. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1995 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
1996 /* Unblock the signal. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1997 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
1998 NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1999 g_object_unref(object);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2000
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2001 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2002 gtk_imhtml_append_text_with_images(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2003 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
2004 0, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2005 /* 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
2006 * cursor gets picked up. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2007 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
2008 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
2009 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2010
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2011 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2012 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2013
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2014 case GDK_Down:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2015 if (!gtkconv->send_history)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2016 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2017
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
2018 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
2019 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
2020
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2021 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
2022 GObject *object;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2023 GtkTextIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2024 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
2025
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2026 gtkconv->send_history = gtkconv->send_history->prev;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2027
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2028 /* 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
2029 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
2030 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
2031 NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2032 /* Clear the formatting. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2033 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
2034 /* Unblock the signal. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2035 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
2036 NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2037 g_object_unref(object);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2038
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2039 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2040 gtk_imhtml_append_text_with_images(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2041 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
2042 0, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2043 /* 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
2044 * cursor gets picked up. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2045 if (*(char *)gtkconv->send_history->data) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2046 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
2047 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
2048 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2049 /* Restore the default formatting */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2050 default_formatize(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2051 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2052 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2053
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2054 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2055 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2056 } /* End of switch */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2057 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2058
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2059 /* If ALT (or whatever) was held down... */
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2060 else if (event->state & GDK_MOD1_MASK) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2061
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2062 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2063
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2064 /* If neither CTRL nor ALT were held down... */
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2065 else {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2066 switch (event->keyval) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2067 case GDK_Tab:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2068 if (gtkconv->entry != entry)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2069 break;
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2070 return tab_complete(conv);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2071 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2072
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2073 case GDK_Page_Up:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2074 gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml));
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2075 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2076 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2077
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2078 case GDK_Page_Down:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2079 gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml));
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2080 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2081 break;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2082
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2083 }
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 return FALSE;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2088 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2089 * NOTE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2090 * 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
2091 * 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
2092 * 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
2093 * 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
2094 * 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
2095 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2096 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2097 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
2098 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2099 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
2100 /* Right single click */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2101 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
2102
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2103 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2104 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2105
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2106 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2107 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2108
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2109 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2110 * 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
2111 * 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
2112 * 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
2113 * 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
2114 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2115 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2116 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
2117 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2118 PidginConversation *gtkconv = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2119
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2120 /* 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
2121 if ((event->state & GDK_CONTROL_MASK) ||
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2122 (event->keyval == GDK_F6) ||
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2123 (event->keyval == GDK_F10) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2124 (event->keyval == GDK_Shift_L) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2125 (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
2126 (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
2127 (event->keyval == GDK_Control_R) ||
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2128 (event->keyval == GDK_Escape) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2129 (event->keyval == GDK_Up) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2130 (event->keyval == GDK_Down) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2131 (event->keyval == GDK_Left) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2132 (event->keyval == GDK_Right) ||
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2133 (event->keyval == GDK_Page_Up) ||
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2134 (event->keyval == GDK_Page_Down) ||
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2135 (event->keyval == GDK_Home) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2136 (event->keyval == GDK_End) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2137 (event->keyval == GDK_Tab) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2138 (event->keyval == GDK_ISO_Left_Tab))
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2139 {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2140 if (event->type == GDK_KEY_PRESS)
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2141 return conv_keypress_common(gtkconv, event);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2142 return FALSE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2143 }
15374
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 if (event->type == GDK_KEY_RELEASE)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2146 gtk_widget_grab_focus(gtkconv->entry);
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 gtk_widget_event(gtkconv->entry, (GdkEvent *)event);
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 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2151 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2152
17846
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
2153 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
2154 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
2155
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2156 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2157 pidgin_conv_switch_active_conversation(PurpleConversation *conv)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2158 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2159 PidginConversation *gtkconv;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2160 PurpleConversation *old_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2161 GtkIMHtml *entry;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2162 const char *protocol_name;
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 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2165
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2166 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2167 old_conv = gtkconv->active_conv;
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 if (old_conv == conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2170 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2171
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2172 purple_conversation_close_logs(old_conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2173 gtkconv->active_conv = conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2174
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2175 purple_conversation_set_logging(conv,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2176 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
2177
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2178 entry = GTK_IMHTML(gtkconv->entry);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2179 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
2180 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
2181 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
2182
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2183 if (!(conv->features & PURPLE_CONNECTION_HTML))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2184 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
2185 else if (conv->features & PURPLE_CONNECTION_FORMATTING_WBFO &&
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2186 !(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
2187 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2188 /* 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
2189 * 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
2190 * 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
2191 * 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
2192 * 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
2193
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2194 gboolean bold;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2195 gboolean italic;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2196 gboolean underline;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2197 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
2198 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
2199 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
2200 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
2201 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
2202 gboolean bold2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2203 gboolean italic2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2204 gboolean underline2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2205
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2206 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
2207
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2208 /* Clear existing formatting */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2209 gtk_imhtml_clear_formatting(entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2210
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2211 /* Apply saved formatting to the whole buffer. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2212
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2213 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
2214
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2215 if (bold != bold2)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2216 gtk_imhtml_toggle_bold(entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2217
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2218 if (italic != italic2)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2219 gtk_imhtml_toggle_italic(entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2220
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2221 if (underline != underline2)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2222 gtk_imhtml_toggle_underline(entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2223
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2224 gtk_imhtml_toggle_fontface(entry, fontface);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2225
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2226 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
2227 gtk_imhtml_font_set_size(entry, fontsize);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2228
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2229 gtk_imhtml_toggle_forecolor(entry, forecolor);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2230
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2231 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
2232 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2233 gtk_imhtml_toggle_backcolor(entry, backcolor);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2234 gtk_imhtml_toggle_background(entry, background);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2235 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2236
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2237 g_free(fontface);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2238 g_free(forecolor);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2239 g_free(backcolor);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2240 g_free(background);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2241 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2242 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2243 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2244 /* 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
2245 * 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
2246 * 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
2247 * 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
2248 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
2249 (conv->features & PURPLE_CONNECTION_FORMATTING_WBFO));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2250 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2251
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2252 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
2253
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2254 gray_stuff_out(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2255 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
2256 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
2257 regenerate_options_items(gtkconv->win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2258
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2259 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
2260 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
2261 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2262
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2263 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2264 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
2265 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2266 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
2267 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
2268 PurpleConversation *conv;
15374
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 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
2271 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2272
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2273 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
2274 pidgin_conv_switch_active_conversation(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2275 }
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 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2278 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2279 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
2280 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2281 PidginConversation *gtkconv = (PidginConversation *)user_data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2282 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2283
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2284 g_return_if_fail(gtkconv != NULL);
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 conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2287
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
2288 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
2289 return;
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 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
2292 gtk_text_iter_is_end(position)));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2293 }
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 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2296 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
2297 GtkTextIter *end_pos, gpointer user_data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2298 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2299 PidginConversation *gtkconv = (PidginConversation *)user_data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2300 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2301 PurpleConvIm *im;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2302
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2303 g_return_if_fail(gtkconv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2304
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2305 conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2306
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
2307 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
2308 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2309
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2310 im = PURPLE_CONV_IM(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2311
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2312 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
2313
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2314 /* 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
2315 purple_conv_im_stop_send_typed_timeout(im);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2316
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2317 serv_send_typing(purple_conversation_get_gc(conv),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2318 purple_conversation_get_name(conv),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2319 PURPLE_NOT_TYPING);
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 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2322 /* 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
2323 got_typing_keypress(gtkconv, FALSE);
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2326
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2327 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2328 * A bunch of buddy icon functions
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2329 **************************************************************************/
15724
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2330
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2331 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
2332 {
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2333 GList *l = NULL;
17397
012aaa301a30 Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17392
diff changeset
2334 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
2335 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
2336 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
2337 l = g_hash_table_lookup(prpl_lists, prplname);
15724
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2338 if (l)
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2339 return l;
17397
012aaa301a30 Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17392
diff changeset
2340
012aaa301a30 Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17392
diff changeset
2341 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
2342 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
2343 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
2344
012aaa301a30 Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17392
diff changeset
2345 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
2346 return l;
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2347 }
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2348
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2349 static GList *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2350 pidgin_conv_get_tab_icons(PurpleConversation *conv)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2351 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2352 PurpleAccount *account = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2353 const char *name = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2354
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2355 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
2356
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2357 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2358 name = purple_conversation_get_name(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2359
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2360 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
2361 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
2362
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2363 /* Use the buddy icon, if possible */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2364 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
2365 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
2366 if (b != NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2367 PurplePresence *p;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2368 p = purple_buddy_get_presence(b);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2369 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
2370 return away_list;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2371 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
2372 return busy_list;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2373 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
2374 return xa_list;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2375 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
2376 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
2377 else
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2378 return available_list;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2379 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2380 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2381
15724
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2382 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
2383 }
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2384
19899
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2385 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
2386 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
2387 {
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2388 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
2389 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
2390 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
2391 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
2392 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
2393
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2394 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
2395 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
2396
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2397 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
2398 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
2399
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2400 /* 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
2401 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
2402 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
2403 if (b != NULL) {
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2404 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
2405 /* 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
2406 * 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
2407 * 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
2408 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
2409 ops->update(NULL, (PurpleBlistNode*)b);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2410
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2411 /* 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
2412 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
2413 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
2414 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
2415 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
2416 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
2417 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
2418 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
2419 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
2420 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
2421 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
2422 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
2423 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
2424 }
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2425 }
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2426
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2427 /* 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
2428 if (status == NULL) {
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2429 GtkIconSize size = gtk_icon_size_from_name(icon_size);
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2430 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
2431 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
2432 size, "GtkWidget");
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2433 } 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
2434 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
2435 size, "GtkWidget");
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2436 }
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2437 }
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2438 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
2439 }
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2440
19899
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2441 GdkPixbuf *
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2442 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
2443 {
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2444 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
2445 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
2446 }
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2447
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2448
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2449 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2450 update_tab_icon(PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2451 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2452 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2453 PidginWindow *win;
16315
ee4ce3c4186f Fix #248 (Control shouldn't steal focus from scrollback)
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16286
diff changeset
2454 GList *l;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2455 GdkPixbuf *status = NULL;
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2456 GdkPixbuf *infopane_status = NULL;
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2457 GdkPixbuf *emblem = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2458
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2459 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2460
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2461 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2462 win = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2463 if (conv != gtkconv->active_conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2464 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2465
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
2466 status = pidgin_conv_get_tab_icon(conv, TRUE);
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2467 infopane_status = pidgin_conv_get_tab_icon(conv, FALSE);
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2468
21991
cca516eb7610 Show the emblem in conversation infopane correctly for chats.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21951
diff changeset
2469 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
2470 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
2471 if (b)
cca516eb7610 Show the emblem in conversation infopane correctly for chats.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21951
diff changeset
2472 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
2473 } else {
cca516eb7610 Show the emblem in conversation infopane correctly for chats.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21951
diff changeset
2474 PurpleChat *c = purple_blist_find_chat(conv->account, conv->name);
cca516eb7610 Show the emblem in conversation infopane correctly for chats.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21951
diff changeset
2475 if (c)
cca516eb7610 Show the emblem in conversation infopane correctly for chats.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21951
diff changeset
2476 emblem = pidgin_blist_get_emblem((PurpleBlistNode*)c);
cca516eb7610 Show the emblem in conversation infopane correctly for chats.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21951
diff changeset
2477 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2478
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2479 g_return_if_fail(status != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2480
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2481 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
2482 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
2483
18214
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2484 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
2485 &(gtkconv->infopane_iter),
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2486 CONV_ICON_COLUMN, infopane_status, -1);
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2487
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2488 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
2489 &(gtkconv->infopane_iter),
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2490 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
2491 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
2492 g_object_unref(emblem);
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2493
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
2494 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
2495 emblem = pidgin_create_prpl_icon(gtkconv->active_conv->account, PIDGIN_PRPL_ICON_SMALL);
19474
74befdcd0454 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@gmail.com>
parents: 19468
diff changeset
2496 gtk_list_store_set(GTK_LIST_STORE(gtkconv->infopane_model),
74befdcd0454 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@gmail.com>
parents: 19468
diff changeset
2497 &(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
2498 CONV_PROTOCOL_ICON_COLUMN, emblem, -1);
6b9e5bbab0fe We need to unref the pixmaps after adding them to a list store.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20796
diff changeset
2499 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
2500 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
2501 }
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
2502
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
2503 /* XXX seanegan Why do I have to do this? */
8f36a83bc1cf Redraw infopane after setting icons. I'm not sure why I need to do this. I'll look into it later. Fixes #1892
Sean Egan <seanegan@gmail.com>
parents: 18632
diff changeset
2504 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
2505
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2506 if (status != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2507 g_object_unref(status);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2508
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2509 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
2510 (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
2511 gtkconv->u.im->anim == NULL))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2512 {
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2513 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
2514
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2515 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
2516 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2517 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2518
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2519 /* 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
2520 * 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
2521 * 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
2522 * 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
2523 * gets set back to FALSE
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2524 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2525 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
2526 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2527 PidginConversation *gtkconv = (PidginConversation *)data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2528 gtkconv->auto_resize = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2529 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2530 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2531
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2532 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2533 redraw_icon(gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2534 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2535 PidginConversation *gtkconv = (PidginConversation *)data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2536 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2537 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2538 PurplePluginProtocolInfo *prpl_info = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2539
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2540 GdkPixbuf *buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2541 GdkPixbuf *scale;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2542 gint delay;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2543 int scale_width, scale_height;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2544
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2545 gtkconv = PIDGIN_CONVERSATION(conv);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2546 account = purple_conversation_get_account(conv);
16604
598b66923c81 hopefully fix 236
Nathan Walp <nwalp@pidgin.im>
parents: 16577
diff changeset
2547
598b66923c81 hopefully fix 236
Nathan Walp <nwalp@pidgin.im>
parents: 16577
diff changeset
2548 if(account && account->gc) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2549 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(account->gc->prpl);
16604
598b66923c81 hopefully fix 236
Nathan Walp <nwalp@pidgin.im>
parents: 16577
diff changeset
2550 } else {
598b66923c81 hopefully fix 236
Nathan Walp <nwalp@pidgin.im>
parents: 16577
diff changeset
2551 gtkconv->u.im->icon_timer = 0;
598b66923c81 hopefully fix 236
Nathan Walp <nwalp@pidgin.im>
parents: 16577
diff changeset
2552 return FALSE;
598b66923c81 hopefully fix 236
Nathan Walp <nwalp@pidgin.im>
parents: 16577
diff changeset
2553 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2554
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2555 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
2556 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
2557
18214
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2558 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
2559 scale_height = gdk_pixbuf_get_height(buf);
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2560 if (scale_width == scale_height) {
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2561 scale_width = scale_height = 32;
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2562 } else if (scale_height > scale_width) {
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2563 scale_width = 32 * scale_width / scale_height;
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2564 scale_height = 32;
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2565 } else {
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2566 scale_height = 32 * scale_height / scale_width;
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2567 scale_width = 32;
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2568 }
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2569
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2570 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
2571 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
2572 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
2573 pidgin_gdk_pixbuf_make_round(scale);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2574
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2575 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
2576 g_object_unref(G_OBJECT(scale));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2577 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
2578
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2579 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
2580
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2581 if (delay < 100)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2582 delay = 100;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2583
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2584 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
2585
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2586 return 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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2589 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2590 start_anim(GtkObject *obj, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2591 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2592 int delay;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2593
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2594 if (gtkconv->u.im->anim == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2595 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2596
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2597 if (gtkconv->u.im->icon_timer != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2598 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2599
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2600 if (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
2601 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2602
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2603 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
2604
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2605 if (delay < 100)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2606 delay = 100;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2607
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2608 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
2609 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2610
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2611 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2612 remove_icon(GtkWidget *widget, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2613 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2614 PurpleConversation *conv = gtkconv->active_conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2615 PidginWindow *gtkwin;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2616
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2617 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2618
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2619 if (gtkconv->u.im->icon_container != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2620 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
2621
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2622 if (gtkconv->u.im->anim != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2623 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
2624
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2625 if (gtkconv->u.im->icon_timer != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2626 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
2627
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2628 if (gtkconv->u.im->iter != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2629 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
2630
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2631 gtkconv->u.im->icon_timer = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2632 gtkconv->u.im->icon = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2633 gtkconv->u.im->anim = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2634 gtkconv->u.im->iter = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2635 gtkconv->u.im->icon_container = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2636 gtkconv->u.im->show_icon = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2637
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2638 gtkwin = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2639 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2640
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2641 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2642 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
2643 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2644 PidginConversation *gtkconv = (PidginConversation *)user_data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2645 PurpleConversation *conv = gtkconv->active_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2646 FILE *fp;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2647 PurpleBuddyIcon *icon;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2648 const void *data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2649 size_t len;
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 ((fp = g_fopen(filename, "wb")) == NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2652 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
2653 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2654 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2655
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2656 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
2657 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
2658
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2659 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
2660 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
2661 fclose(fp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2662 g_unlink(filename);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2663 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2664 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2665 fclose(fp);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2668 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2669 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
2670 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2671 if (filename) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2672 PidginConversation *gtkconv = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2673 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2674 PurpleAccount *account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2675 pidgin_set_custom_buddy_icon(account, purple_conversation_get_name(conv), filename);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2676 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2677 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2678
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2679 static void
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2680 set_custom_icon_cb(GtkWidget *widget, PidginConversation *gtkconv)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2681 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2682 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
2683 custom_icon_sel_cb, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2684 gtk_widget_show_all(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2685 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2686
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2687 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2688 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
2689 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2690 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2691 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2692
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2693 conv = gtkconv->active_conv;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2694 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2695 pidgin_set_custom_buddy_icon(account, purple_conversation_get_name(conv), NULL);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2696 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2697
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2698 static void
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2699 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
2700 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2701 PurpleConversation *conv = gtkconv->active_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2702 const gchar *ext;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2703 gchar *buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2704
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2705 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2706
16375
391a79778f89 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@wiktel.com>
parents: 16373
diff changeset
2707 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
2708
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2709 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
2710
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2711 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
2712 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
2713 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
2714 gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2715
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2716 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2717 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2718
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2719 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2720 stop_anim(GtkObject *obj, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2721 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2722 if (gtkconv->u.im->icon_timer != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2723 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
2724
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2725 gtkconv->u.im->icon_timer = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2726 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2727
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 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2730 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
2731 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2732 gtkconv->u.im->animate =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2733 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
2734
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2735 if (gtkconv->u.im->animate)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2736 start_anim(NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2737 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2738 stop_anim(NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2739 }
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 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2742 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
2743 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2744 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
2745 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
2746 PurpleBuddy *buddy;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2747
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2748 if (e->button != 3 || e->type != GDK_BUTTON_PRESS)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2749 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2750
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2751 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2752 * 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
2753 * thus freeing-up the memory it occupied.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2754 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2755 if (menu != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2756 gtk_widget_destroy(menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2757
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2758 menu = gtk_menu_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2759
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2760 if (gtkconv->u.im->anim &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2761 !(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
2762 {
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
2763 pidgin_new_check_item(menu, _("Animate"),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2764 G_CALLBACK(toggle_icon_animate_cb), gtkconv,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2765 gtkconv->u.im->icon_timer);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2766 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2767
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
2768 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
2769 gtkconv, 0, 0, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2770
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
2771 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
2772 G_CALLBACK(icon_menu_save_cb), gtkconv,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2773 0, 0, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2774
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
2775 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
2776 G_CALLBACK(set_custom_icon_cb), gtkconv,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2777 0, 0, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2778
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2779 /* 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
2780 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
2781 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
2782 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
2783 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
2784 {
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
2785 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
2786 if (contact && purple_buddy_icons_has_custom_icon(contact))
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
2787 {
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
2788 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
2789 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
2790 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
2791 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2792 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2793
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2794 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
2795
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2796 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2797 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2798
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2799 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2800 * 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
2801 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2802 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2803 pidgin_conv_present_conversation(PurpleConversation *conv)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2804 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2805 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
19417
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
2806 GdkModifierType state;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2807
19898
be8bb6f98c01 Get rid of hidden_convwin.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
2808 if (gtkconv == NULL) {
be8bb6f98c01 Get rid of hidden_convwin.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
2809 pidgin_conv_attach_to_conversation(conv);
be8bb6f98c01 Get rid of hidden_convwin.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
2810 gtkconv = PIDGIN_CONVERSATION(conv);
21702
cf579f61b887 merge of '2dee17b0fb69284b66649d32e66b473471970a43'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21701 19905
diff changeset
2811 } else if (gtkconv->win == hidden_convwin) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2812 pidgin_conv_window_remove_gtkconv(hidden_convwin, gtkconv);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
2813 pidgin_conv_placement_place(gtkconv);
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
2814 }
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
2815
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
2816 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
2817 /* 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
2818 * 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
2819 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
2820 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
2821 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
2822 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2823
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2824 GList *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2825 pidgin_conversations_find_unseen_list(PurpleConversationType type,
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
2826 PidginUnseenState min_state,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2827 gboolean hidden_only,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2828 guint max_count)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2829 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
2830 GList *l;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2831 GList *r = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2832 guint c = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2833
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2834 if (type == PURPLE_CONV_TYPE_IM) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2835 l = purple_get_ims();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2836 } else if (type == PURPLE_CONV_TYPE_CHAT) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2837 l = purple_get_chats();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2838 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2839 l = purple_get_conversations();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2840 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2841
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2842 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
2843 PurpleConversation *conv = (PurpleConversation*)l->data;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2844 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2845
19417
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
2846 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
2847 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2848
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2849 if (gtkconv->unseen_state >= min_state
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2850 && (!hidden_only ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2851 (hidden_only && gtkconv->win == hidden_convwin))) {
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 r = g_list_prepend(r, conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2854 c++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2855 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2856 }
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 return r;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2859 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2860
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2861 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2862 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
2863 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2864 g_return_if_fail(conv != NULL);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
2865 pidgin_conv_present_conversation(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2866 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2867
19584
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2868 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
2869 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
2870 {
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2871 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
2872 /* 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
2873 * '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
2874 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
2875 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
2876 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
2877 }
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2878 }
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2879
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2880 guint
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2881 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
2882 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2883 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2884 guint ret=0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2885
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2886 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
2887 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
2888
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2889 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
2890 PurpleConversation *conv = (PurpleConversation*)l->data;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2891 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2892
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2893 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
2894 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
2895 GtkWidget *item;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2896 gchar *text = g_strdup_printf("%s (%d)",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2897 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
2898 gtkconv->unseen_count);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2899
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2900 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
2901 g_object_unref(pbuf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2902
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2903 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
2904 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
2905 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
2906 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
2907 g_free(text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2908 ret++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2909 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2910
19584
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2911 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
2912 /* 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
2913 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
2914 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
2915
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2916 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
2917
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2918 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
2919 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
2920 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
2921 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
2922 }
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2923
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2924 return ret;
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
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2927 PidginWindow *
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
2928 pidgin_conv_get_window(PidginConversation *gtkconv)
15374
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 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
2931 return gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2932 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2933
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2934 static GtkItemFactoryEntry menu_items[] =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2935 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2936 /* Conversation menu */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2937 { N_("/_Conversation"), NULL, NULL, 0, "<Branch>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2938
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2939 { 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
2940 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
2941
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2942 { "/Conversation/sep0", NULL, NULL, 0, "<Separator>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2943
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2944 { 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
2945 "<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
2946 { 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
2947 { 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
2948 "<StockItem>", GTK_STOCK_SAVE_AS },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2949 { 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
2950
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2951 { "/Conversation/sep1", NULL, NULL, 0, "<Separator>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2952
16839
d6ccf170148e New Send File icon
Hylke Bons <hylkebons@gmail.com>
parents: 16809
diff changeset
2953 { 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
2954 { 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
2955 0, "<Item>", NULL },
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2956 { 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
2957 "<StockItem>", PIDGIN_STOCK_TOOLBAR_USER_INFO },
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2958 { 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
2959 "<Item>", NULL },
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2960 { 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
2961
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2962 { "/Conversation/sep2", NULL, NULL, 0, "<Separator>", NULL },
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 { 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
2965 "<Item>", NULL },
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2966 { 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
2967 "<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
2968 { 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
2969 "<StockItem>", PIDGIN_STOCK_TOOLBAR_UNBLOCK },
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2970 { 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
2971 "<StockItem>", GTK_STOCK_ADD },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2972 { 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
2973 "<StockItem>", GTK_STOCK_REMOVE },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2974
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2975 { "/Conversation/sep3", NULL, NULL, 0, "<Separator>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2976
17776
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
2977 { 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
2978 "<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
2979 { 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
2980 "<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
2981
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
2982 { "/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
2983
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
2984
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2985 { 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
2986 "<StockItem>", GTK_STOCK_CLOSE },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2987
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2988 /* Options */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2989 { N_("/_Options"), NULL, NULL, 0, "<Branch>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2990 { 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
2991 { 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
2992 { "/Options/sep0", NULL, NULL, 0, "<Separator>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2993 { N_("/Options/Show Formatting _Toolbars"), NULL, menu_toolbar_cb, 0, "<CheckItem>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2994 { N_("/Options/Show Ti_mestamps"), "F2", menu_timestamps_cb, 0, "<CheckItem>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2995 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2996
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2997 static const int menu_item_count =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2998 sizeof(menu_items) / sizeof(*menu_items);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2999
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3000 static const char *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3001 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
3002 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3003 return _(path);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3004 }
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 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3007 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
3008 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3009 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3010 PidginWindow *win = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3011 const char *method = value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3012
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3013 if (!strcmp(method, "none"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3014 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3015 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
3016 FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3017 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
3018 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3019 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3020 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3021 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
3022
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3023 if (gtkconv != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3024 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
3025 gtkconv->make_sound);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3026 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
3027
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3028 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3029 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3030
18658
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3031 /* 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
3032 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
3033 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
3034 {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3035 GList *list;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3036 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
3037 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
3038 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
3039 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
3040 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
3041
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3042 conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3043
17846
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3044 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
3045 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
3046
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3047 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
3048 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
3049 }
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3050
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3051 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
3052 GHashTable *components;
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3053 components = g_hash_table_new_full(g_str_hash, g_str_equal,
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3054 g_free, g_free);
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3055 g_hash_table_replace(components, g_strdup("channel"),
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3056 g_strdup(conv->name));
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3057 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
3058 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
3059 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
3060 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
3061 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
3062 }
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3063 } 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
3064 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
3065 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
3066
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
3067 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
3068
17846
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3069 /* 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
3070 * 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
3071 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
3072 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
3073 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
3074 }
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3075
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3076 if ((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
3077 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
3078 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
3079 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
3080 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
3081 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
3082 }
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3083 }
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3084 }
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3085
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
3086 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
3087 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
3088 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
3089 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
3090
18658
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3091 /* 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
3092 if (all) {
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
3093 if (buddy)
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
3094 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
3095 else if (chat) {
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
3096 /* XXX: */
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
3097 }
18658
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3098 } 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
3099 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
3100 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
3101 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
3102 }
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3103
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3104 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
3105 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
3106 } else {
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3107 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
3108 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
3109 }
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3110 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
3111 }
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3112
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3113 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
3114 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
3115 {
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3116 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
3117 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
3118 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
3119
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3120 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
3121 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
3122
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3123 /* Remove the previous entries */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3124 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
3125 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3126 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
3127 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
3128 gtk_widget_destroy(w);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3129 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3130
18658
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3131 if (!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
3132 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3133 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
3134 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
3135 gtk_widget_set_sensitive(item, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3136 }
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_widget_show_all(menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3139 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3140
17392
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3141 static void
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3142 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
3143 {
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3144 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
3145 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
3146 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
3147 }
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3148
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3149 static void
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3150 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
3151 {
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3152 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
3153 GtkWidget *menu;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3154 GList *list;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3155 PidginConversation *gtkconv;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3156 PurpleConversation *conv;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3157 GtkWidget *item;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3158
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
3159 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
3160 return;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3161
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3162 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
3163 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
3164 return;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3165
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3166 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
3167 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
3168
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3169 /* 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
3170 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
3171 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
3172 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
3173 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
3174 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
3175 }
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3176
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3177 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
3178
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3179 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
3180 if (list) {
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3181 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
3182 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
3183 }
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3184
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3185 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
3186 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
3187 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
3188 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
3189 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
3190 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
3191 }
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3192 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
3193 }
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3194
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3195 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
3196 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3197 PidginWindow *win = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3198 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
3199 regenerate_plugins_items(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3200
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3201 /* 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
3202 * 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
3203 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
3204 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
3205 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3206
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3207 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3208 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
3209 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3210 /* 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
3211 * the 'Conversation' menu pops up. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3212 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
3213 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
3214 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
3215 G_CALLBACK(focus_out_from_menubar), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3216 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3217
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3218 static GtkWidget *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3219 setup_menubar(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3220 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3221 GtkAccelGroup *accel_group;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3222 const char *method;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3223 GtkWidget *menuitem;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3224
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3225 accel_group = gtk_accel_group_new ();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3226 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
3227 g_object_unref(accel_group);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3228
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3229 win->menu.item_factory =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3230 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
3231
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3232 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
3233 (GtkTranslateFunc)item_factory_translate_func,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3234 NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3235
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3236 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
3237 menu_items, win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3238 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
3239 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
3240
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3241 /* 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
3242 * 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
3243 * conversation is created. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3244 menuitem = gtk_item_factory_get_item(win->menu.item_factory, N_("/Conversation"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3245 g_signal_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
3246
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3247 win->menu.menubar =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3248 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
3249
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3250 win->menu.view_log =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3251 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
3252 N_("/Conversation/View Log"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3253
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3254 /* --- */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3255
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3256 win->menu.send_file =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3257 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
3258 N_("/Conversation/Send File..."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3259
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3260 win->menu.add_pounce =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3261 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
3262 N_("/Conversation/Add Buddy Pounce..."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3263
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3264 /* --- */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3265
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3266 win->menu.get_info =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3267 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
3268 N_("/Conversation/Get Info"));
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 win->menu.invite =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3271 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
3272 N_("/Conversation/Invite..."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3273
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3274 /* --- */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3275
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3276 win->menu.alias =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3277 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
3278 N_("/Conversation/Alias..."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3279
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3280 win->menu.block =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3281 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
3282 N_("/Conversation/Block..."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3283
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
3284 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
3285 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
3286 N_("/Conversation/Unblock..."));
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
3287
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3288 win->menu.add =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3289 gtk_item_factory_get_widget(win->menu.item_factory,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3290 N_("/Conversation/Add..."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3291
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3292 win->menu.remove =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3293 gtk_item_factory_get_widget(win->menu.item_factory,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3294 N_("/Conversation/Remove..."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3295
17776
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3296 /* --- */
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3297
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3298 win->menu.insert_link =
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3299 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
3300 N_("/Conversation/Insert Link..."));
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3301
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3302 win->menu.insert_image =
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3303 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
3304 N_("/Conversation/Insert Image..."));
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3305
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3306 /* --- */
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3307
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3308 win->menu.logging =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3309 gtk_item_factory_get_widget(win->menu.item_factory,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3310 N_("/Options/Enable Logging"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3311 win->menu.sounds =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3312 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
3313 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
3314 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
3315 if (method != NULL && !strcmp(method, "none"))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3316 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3317 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
3318 FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3319 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
3320 }
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
3321 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
3322 sound_method_pref_changed_cb, win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3323
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3324 win->menu.show_formatting_toolbar =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3325 gtk_item_factory_get_widget(win->menu.item_factory,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3326 N_("/Options/Show Formatting Toolbars"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3327 win->menu.show_timestamps =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3328 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
3329 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
3330 win->menu.show_icon = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3331
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3332 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
3333 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
3334 win->menu.tray);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3335 gtk_widget_show(win->menu.tray);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3336
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3337 gtk_widget_show(win->menu.menubar);
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 return win->menu.menubar;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3340 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3341
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3342
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3343 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3344 * Utility functions
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3345 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3346
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3347 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3348 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
3349 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3350 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3351 PurpleConvIm *im;
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 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3354 * 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
3355 * send PURPLE_TYPED any time soon.
15374
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
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3358 im = PURPLE_CONV_IM(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3359
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3360 purple_conv_im_stop_send_typed_timeout(im);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3361 purple_conv_im_start_send_typed_timeout(im);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3362
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3363 /* 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
3364 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
3365 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
3366 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3367 unsigned int timeout;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3368 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
3369 purple_conversation_get_name(conv),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3370 PURPLE_TYPING);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3371 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
3372 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3373 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3374
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
3375 #if 0
15725
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3376 static gboolean
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3377 typing_animation(gpointer data) {
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3378 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
3379 PidginWindow *gtkwin = gtkconv->win;
15725
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3380 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
3381
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
3382 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
3383 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
3384 }
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
3385
15725
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3386 switch (rand() % 5) {
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3387 case 0:
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3388 stock_id = PIDGIN_STOCK_ANIMATION_TYPING0;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3389 break;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3390 case 1:
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3391 stock_id = PIDGIN_STOCK_ANIMATION_TYPING1;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3392 break;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3393 case 2:
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3394 stock_id = PIDGIN_STOCK_ANIMATION_TYPING2;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3395 break;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3396 case 3:
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3397 stock_id = PIDGIN_STOCK_ANIMATION_TYPING3;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3398 break;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3399 case 4:
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3400 stock_id = PIDGIN_STOCK_ANIMATION_TYPING4;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3401 break;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3402 }
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3403 if (gtkwin->menu.typing_icon == NULL) {
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3404 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
3405 pidgin_menu_tray_append(PIDGIN_MENU_TRAY(gtkwin->menu.tray),
15725
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3406 gtkwin->menu.typing_icon,
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3407 _("User is typing..."));
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3408 } else {
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3409 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
3410 }
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3411 gtk_widget_show(gtkwin->menu.typing_icon);
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3412 return TRUE;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3413 }
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
3414 #endif
15725
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3415
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3416 static void
21875
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3417 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
3418 {
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3419 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml));
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3420 GtkTextMark *stmark, *enmark;
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3421
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3422 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
3423 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
3424 if (stmark && enmark) {
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3425 GtkTextIter start, end;
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3426 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
3427 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
3428 gtk_text_buffer_delete_mark(buffer, stmark);
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3429 gtk_text_buffer_delete_mark(buffer, enmark);
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3430 gtk_text_buffer_delete(buffer, &start, &end);
21897
a64a7bc69f42 Avoid jumpiness when typing notification in the conv. history is removed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21896
diff changeset
3431 } else if (message && *message == '\n' && !*(message + 1))
a64a7bc69f42 Avoid jumpiness when typing notification in the conv. history is removed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21896
diff changeset
3432 message = NULL;
21875
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3433
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3434 if (message) {
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3435 GtkTextIter iter;
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3436 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
3437 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
3438 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
3439 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
3440 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
3441 }
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3442 }
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3443
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3444 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3445 update_typing_icon(PidginConversation *gtkconv)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3446 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3447 PidginWindow *gtkwin;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3448 PurpleConvIm *im = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3449 PurpleConversation *conv = gtkconv->active_conv;
21875
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3450 char *message = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3451
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3452 gtkwin = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3453
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3454 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
3455 im = PURPLE_CONV_IM(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3456
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
3457 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
3458 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
3459
99bf55ec6ca4 Fix an invalid read that occurs because we were accessing IM data when the
Richard Laager <rlaager@wiktel.com>
parents: 16483
diff changeset
3460 if (purple_conv_im_get_typing_state(im) == PURPLE_NOT_TYPING) {
21897
a64a7bc69f42 Avoid jumpiness when typing notification in the conv. history is removed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21896
diff changeset
3461 update_typing_message(gtkconv, "\n");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3462 return;
15725
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3463 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3464
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3465 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
3466 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
3467 } else {
22038
13d290879e0a shorted the 'typing then stopped' message
Sean Egan <seanegan@gmail.com>
parents: 22037
diff changeset
3468 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
3469 }
13d290879e0a shorted the 'typing then stopped' message
Sean Egan <seanegan@gmail.com>
parents: 22037
diff changeset
3470
21875
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3471 update_typing_message(gtkconv, message);
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3472 g_free(message);
15374
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 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3476 update_send_to_selection(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3477 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3478 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3479 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3480 GtkWidget *menu;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3481 GList *child;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3482 PurpleBuddy *b;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3483
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3484 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
3485
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3486 if (conv == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3487 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3488
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3489 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3490
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3491 if (account == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3492 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3493
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3494 if (win->menu.send_to == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3495 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3496
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3497 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
3498 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3499
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3500
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3501 gtk_widget_show(win->menu.send_to);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3502
18658
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3503 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
3504
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3505 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
3506 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
3507 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
3508
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3509 GtkWidget *item = child->data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3510 PurpleBuddy *item_buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3511 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
3512 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
3513 "purple_buddy_name");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3514 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
3515
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3516 if (b == item_buddy) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3517 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
3518 g_list_free(child);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3519 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3520 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3521 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3522
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3523 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3524 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3525
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3526 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3527 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
3528 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3529 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
3530 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3531 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3532
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3533 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3534 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
3535 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3536 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
3537 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3538 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3539
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3540 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3541 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
3542 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3543 GtkWidget *box;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3544 GtkWidget *label;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3545 GtkWidget *image;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3546 GtkWidget *menuitem;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3547 GdkPixbuf *pixbuf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3548 gchar *text;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3549
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3550 /* Create a pixmap for the protocol icon. */
15542
a1e0b153fc30 prpl icons in Send To menu
Sean Egan <seanegan@gmail.com>
parents: 15534
diff changeset
3551 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
3552
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3553 /* Now convert it to GtkImage */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3554 if (pixbuf == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3555 image = gtk_image_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3556 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3557 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3558 image = gtk_image_new_from_pixbuf(pixbuf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3559 g_object_unref(G_OBJECT(pixbuf));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3560 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3561
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3562 gtk_size_group_add_widget(sg, image);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3563
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3564 /* Make our menu item */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3565 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
3566 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
3567 g_free(text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3568 *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
3569
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3570 /* 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
3571 box = gtk_hbox_new(FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3572
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3573 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
3574 g_object_ref(label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3575 gtk_container_remove(GTK_CONTAINER(menuitem), label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3576
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3577 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
3578 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
3579
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3580 if (buddy != NULL &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3581 !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
3582 !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
3583 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3584 gtk_widget_set_sensitive(label, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3585
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3586 /* 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
3587 * 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
3588 * 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
3589 * (insensitive style) text.*/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3590 g_signal_connect(menuitem, "enter-notify-event",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3591 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
3592 g_signal_connect(menuitem, "leave-notify-event",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3593 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
3594 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3595
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3596 g_object_unref(label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3597
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3598 gtk_container_add(GTK_CONTAINER(menuitem), box);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3599
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3600 gtk_widget_show(label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3601 gtk_widget_show(image);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3602 gtk_widget_show(box);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3603
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3604 /* Set our data and callbacks. */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3605 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
3606 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
3607
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3608 g_signal_connect(G_OBJECT(menuitem), "activate",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3609 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
3610
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3611 gtk_widget_show(menuitem);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3612 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
3613 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3614
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3615 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3616 generate_send_to_items(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3617 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3618 GtkWidget *menu;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3619 GSList *group = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3620 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
3621 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3622 GSList *l, *buds;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3623
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3624 g_return_if_fail(win != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3625
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3626 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
3627
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3628 g_return_if_fail(gtkconv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3629
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3630 if (win->menu.send_to != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3631 gtk_widget_destroy(win->menu.send_to);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3632
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3633 /* 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
3634 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
3635 gtk_widget_show(win->menu.send_to);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3636
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3637 menu = gtk_menu_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3638 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
3639 win->menu.send_to, 2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3640 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
3641
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3642 gtk_widget_show(menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3643
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3644 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
3645 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
3646
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3647 if (buds == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3648 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3649 /* The user isn't on the buddy list. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3650 create_sendto_item(menu, sg, &group, NULL, gtkconv->active_conv->account, gtkconv->active_conv->name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3651 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3652 else
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 GList *list = NULL, *iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3655 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
3656 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3657 PurpleBlistNode *node;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3658
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3659 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
3660
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3661 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
3662 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3663 PurpleBuddy *buddy = (PurpleBuddy *)node;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3664 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3665
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3666 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
3667 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3668
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3669 account = purple_buddy_get_account(buddy);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3670 if (purple_account_is_connected(account))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3671 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3672 /* Use the PurplePresence to get unique buddies. */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3673 PurplePresence *presence = purple_buddy_get_presence(buddy);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3674 if (!g_list_find(list, presence))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3675 list = g_list_prepend(list, presence);
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3679
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3680 /* Loop over the list backwards so we get the items in the right order,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3681 * since we did a g_list_prepend() earlier. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3682 for (iter = g_list_last(list); iter != NULL; iter = iter->prev)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3683 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3684 PurplePresence *pre = iter->data;
16809
c4460fa22886 Change some of the PurplePresence stuff to reflect how it's actually used
Sean Egan <seanegan@gmail.com>
parents: 16681
diff changeset
3685 PurpleBuddy *buddy = purple_presence_get_buddy(pre);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3686 create_sendto_item(menu, sg, &group, buddy,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3687 purple_buddy_get_account(buddy), purple_buddy_get_name(buddy));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3688 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3689 g_list_free(list);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3690 g_slist_free(buds);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3691 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3692 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3693
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3694 g_object_unref(sg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3695
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3696 gtk_widget_show(win->menu.send_to);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3697 /* 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
3698 if (!group)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3699 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
3700 update_send_to_selection(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3701 }
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 static GList *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3704 generate_invite_user_names(PurpleConnection *gc)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3705 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3706 PurpleBlistNode *gnode,*cnode,*bnode;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3707 static GList *tmp = NULL;
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 g_list_free(tmp);
20028
a2b4eac83902 Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19980
diff changeset
3710 tmp = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3711
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3712 if (gc != NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3713 for(gnode = purple_get_blist()->root; gnode; gnode = gnode->next) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3714 if(!PURPLE_BLIST_NODE_IS_GROUP(gnode))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3715 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3716 for(cnode = gnode->child; cnode; cnode = cnode->next) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3717 if(!PURPLE_BLIST_NODE_IS_CONTACT(cnode))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3718 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3719 for(bnode = cnode->child; bnode; bnode = bnode->next) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3720 PurpleBuddy *buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3721
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3722 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
3723 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3724
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3725 buddy = (PurpleBuddy *)bnode;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3726
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3727 if (buddy->account == gc->account &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3728 PURPLE_BUDDY_IS_ONLINE(buddy))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3729 tmp = g_list_insert_sorted(tmp, buddy->name,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3730 (GCompareFunc)g_utf8_collate);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3731 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3732 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3733 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3734 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3735
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3736 return tmp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3737 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3738
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3739 static GdkPixbuf *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3740 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
3741 {
15672
0457791756e7 New chatlist icons. founder and ignored still needed.
Sean Egan <seanegan@gmail.com>
parents: 15632
diff changeset
3742 PidginConversation *gtkconv = PIDGIN_CONVERSATION(chat->conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3743 GdkPixbuf *pixbuf, *scale, *scale2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3744 char *filename;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3745 const char *image = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3746
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3747 if (flags & PURPLE_CBFLAGS_FOUNDER) {
15699
1229a0cd9126 docklet pending status
Sean Egan <seanegan@gmail.com>
parents: 15672
diff changeset
3748 image = PIDGIN_STOCK_STATUS_FOUNDER;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3749 } 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
3750 image = PIDGIN_STOCK_STATUS_OPERATOR;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3751 } 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
3752 image = PIDGIN_STOCK_STATUS_HALFOP;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3753 } 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
3754 image = PIDGIN_STOCK_STATUS_VOICE;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3755 } 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
3756 image = PIDGIN_STOCK_STATUS_IGNORED;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3757 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3758 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3759 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3760
15672
0457791756e7 New chatlist icons. founder and ignored still needed.
Sean Egan <seanegan@gmail.com>
parents: 15632
diff changeset
3761 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
3762 "GtkTreeView");
16315
ee4ce3c4186f Fix #248 (Control shouldn't steal focus from scrollback)
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16286
diff changeset
3763
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3764 if (!pixbuf)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3765 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3766
15990
37d928a6579e these are 16x16 now
Nathan Walp <nwalp@pidgin.im>
parents: 15984
diff changeset
3767 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
3768 g_object_unref(pixbuf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3769
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3770 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
3771 /* 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
3772 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
3773 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
3774 g_free(filename);
15990
37d928a6579e these are 16x16 now
Nathan Walp <nwalp@pidgin.im>
parents: 15984
diff changeset
3775 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
3776 g_object_unref(pixbuf);
15990
37d928a6579e these are 16x16 now
Nathan Walp <nwalp@pidgin.im>
parents: 15984
diff changeset
3777 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
3778 g_object_unref(scale2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3779 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3780
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3781 return scale;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3784 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3785 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
3786 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3787 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3788 PidginChatPane *gtkchat;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3789 PurpleConvChat *chat;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3790 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3791 PurplePluginProtocolInfo *prpl_info;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3792 GtkListStore *ls;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3793 GdkPixbuf *pixbuf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3794 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3795 gboolean is_me = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3796 gboolean is_buddy;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3797 gchar *tmp, *alias_key, *name, *alias;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3798 int flags;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3799
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3800 alias = cb->alias;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3801 name = cb->name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3802 flags = GPOINTER_TO_INT(cb->flags);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3803
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3804 chat = PURPLE_CONV_CHAT(conv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3805 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3806 gtkchat = gtkconv->u.chat;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3807 gc = purple_conversation_get_gc(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3808
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3809 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
3810 return;
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 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
3813
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3814 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
3815
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3816 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
3817 is_me = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3818
18305
ffd706ec0220 Set and use convchatbuddy->buddy.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18302
diff changeset
3819 is_buddy = cb->buddy;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3820
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3821 tmp = g_utf8_casefold(alias, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3822 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
3823 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3824
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3825 if (is_me)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3826 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3827 GdkColor send_color;
21840
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
3828 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
3829
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3830 #if GTK_CHECK_VERSION(2,6,0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3831 gtk_list_store_insert_with_values(ls, &iter,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3832 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3833 * The GTK docs are mute about the effects of the "row" value for performance.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3834 * X-Chat hardcodes their value to 0 (prepend) and -1 (append), so we will too.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3835 * It *might* be faster to search the gtk_list_store and set row accurately,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3836 * but no one in #gtk+ seems to know anything about it either.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3837 * Inserting in the "wrong" location has no visible ill effects. - F.P.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3838 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3839 -1, /* "row" */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3840 CHAT_USERS_ICON_COLUMN, pixbuf,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3841 CHAT_USERS_ALIAS_COLUMN, alias,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3842 CHAT_USERS_ALIAS_KEY_COLUMN, alias_key,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3843 CHAT_USERS_NAME_COLUMN, name,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3844 CHAT_USERS_FLAGS_COLUMN, flags,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3845 CHAT_USERS_COLOR_COLUMN, &send_color,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3846 CHAT_USERS_WEIGHT_COLUMN, is_buddy ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3847 -1);
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 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3850 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3851 gtk_list_store_insert_with_values(ls, &iter,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3852 -1, /* "row" */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3853 CHAT_USERS_ICON_COLUMN, pixbuf,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3854 CHAT_USERS_ALIAS_COLUMN, alias,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3855 CHAT_USERS_ALIAS_KEY_COLUMN, alias_key,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3856 CHAT_USERS_NAME_COLUMN, name,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3857 CHAT_USERS_FLAGS_COLUMN, flags,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3858 CHAT_USERS_COLOR_COLUMN, get_nick_color(gtkconv, name),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3859 CHAT_USERS_WEIGHT_COLUMN, is_buddy ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3860 -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3861 #else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3862 gtk_list_store_append(ls, &iter);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3863 gtk_list_store_set(ls, &iter,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3864 CHAT_USERS_ICON_COLUMN, pixbuf,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3865 CHAT_USERS_ALIAS_COLUMN, alias,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3866 CHAT_USERS_ALIAS_KEY_COLUMN, alias_key,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3867 CHAT_USERS_NAME_COLUMN, name,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3868 CHAT_USERS_FLAGS_COLUMN, flags,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3869 CHAT_USERS_COLOR_COLUMN, &send_color,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3870 CHAT_USERS_WEIGHT_COLUMN, is_buddy ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3871 -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3872 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3873 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3874 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3875 gtk_list_store_append(ls, &iter);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3876 gtk_list_store_set(ls, &iter,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3877 CHAT_USERS_ICON_COLUMN, pixbuf,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3878 CHAT_USERS_ALIAS_COLUMN, alias,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3879 CHAT_USERS_ALIAS_KEY_COLUMN, alias_key,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3880 CHAT_USERS_NAME_COLUMN, name,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3881 CHAT_USERS_FLAGS_COLUMN, flags,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3882 CHAT_USERS_COLOR_COLUMN, get_nick_color(gtkconv, name),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3883 CHAT_USERS_WEIGHT_COLUMN, is_buddy ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3884 -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3885 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3886 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3887
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3888 if (pixbuf)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3889 g_object_unref(pixbuf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3890 g_free(alias_key);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3891 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3892
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3893 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3894 tab_complete_process_item(int *most_matched, char *entered, char **partial, char *nick_partial,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3895 GList **matches, gboolean command, char *name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3896 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3897 strncpy(nick_partial, name, strlen(entered));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3898 nick_partial[strlen(entered)] = '\0';
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3899 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
3900 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3901
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3902 /* 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
3903
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3904 if (*most_matched == -1) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3905 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3906 * 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
3907 * on *most_matched is >= 0
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3908 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3909 *most_matched = strlen(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3910 *partial = g_strdup(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3911 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3912 else if (*most_matched) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3913 char *tmp = g_strdup(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3914
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3915 while (purple_utf8_strcasecmp(tmp, *partial)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3916 (*partial)[*most_matched] = '\0';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3917 if (*most_matched < strlen(tmp))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3918 tmp[*most_matched] = '\0';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3919 (*most_matched)--;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3920 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3921 (*most_matched)++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3922
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3923 g_free(tmp);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3926 *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
3927 (GCompareFunc)purple_utf8_strcasecmp);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3928 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3929
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3930 static gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3931 tab_complete(PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3932 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3933 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3934 GtkTextIter cursor, word_start, start_buffer;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3935 int start;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3936 int most_matched = -1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3937 char *entered, *partial = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3938 char *text;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3939 char *nick_partial;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3940 const char *prefix;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3941 GList *matches = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3942 gboolean command = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3943
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3944 gtkconv = PIDGIN_CONVERSATION(conv);
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 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
3947 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
3948 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
3949
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3950 word_start = cursor;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3951
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3952 /* if there's nothing there just return */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3953 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
3954 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
3955
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3956 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
3957 &cursor, FALSE);
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 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
3960 start = strlen(text) - 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3961
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3962 if (strlen(text) >= 2 && !strncmp(&text[start-1], ": ", 2)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3963 gtk_text_iter_backward_chars(&word_start, 2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3964 start-=2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3965 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3966
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3967 /* find the start of the word that we're tabbing */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3968 while (start >= 0 && text[start] != ' ') {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3969 gtk_text_iter_backward_char(&word_start);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3970 start--;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3971 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3972
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3973 prefix = pidgin_get_cmd_prefix();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3974 if (start == -1 && (strlen(text) >= strlen(prefix)) && !strncmp(text, prefix, strlen(prefix))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3975 command = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3976 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
3977 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3978
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3979 g_free(text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3980
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3981 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
3982 &cursor, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3983
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3984 if (!g_utf8_strlen(entered, -1)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3985 g_free(entered);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3986 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
3987 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3988
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3989 nick_partial = g_malloc(strlen(entered)+1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3990
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3991 if (command) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3992 GList *list = purple_cmd_list(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3993 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3994
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3995 /* Commands */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3996 for (l = list; l != NULL; l = l->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3997 tab_complete_process_item(&most_matched, entered, &partial, nick_partial,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3998 &matches, TRUE, l->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3999 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4000 g_list_free(list);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4001 } 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
4002 PurpleConvChat *chat = PURPLE_CONV_CHAT(conv);
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
4003 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
4004 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
4005 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4006 int f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4007
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4008 /* Users */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4009 for (; l != NULL; l = l->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4010 tab_complete_process_item(&most_matched, entered, &partial, nick_partial,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4011 &matches, TRUE, ((PurpleConvChatBuddy *)l->data)->name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4012 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4013
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 /* Aliases */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4016 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
4017 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4018 do {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4019 char *name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4020 char *alias;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4021
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4022 gtk_tree_model_get(model, &iter,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4023 CHAT_USERS_NAME_COLUMN, &name,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4024 CHAT_USERS_ALIAS_COLUMN, &alias,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4025 -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4026
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
4027 if (name && alias && strcmp(name, alias))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4028 tab_complete_process_item(&most_matched, entered, &partial, nick_partial,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4029 &matches, FALSE, alias);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4030 g_free(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4031 g_free(alias);
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 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
4034 } while (f != 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4035 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4036 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4037 g_free(nick_partial);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4038 g_free(entered);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4039 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4040 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4041
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4042 g_free(nick_partial);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4043
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4044 /* 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
4045
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4046 /* if there weren't any matches, return */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4047 if (!matches) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4048 /* 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
4049 g_free(entered);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4050 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
4051 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4052
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4053 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
4054
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4055 if (!matches->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4056 /* 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
4057 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
4058 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
4059 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
4060
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4061 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
4062 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
4063 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
4064 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4065 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4066 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4067 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
4068 matches->data, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4069
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4070 g_free(matches->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4071 matches = g_list_remove(matches, matches->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4072 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4073 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4074 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4075 * 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
4076 * and display all of them
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4077 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4078 char *addthis = g_malloc0(1);
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 while (matches) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4081 char *tmp = addthis;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4082 addthis = g_strconcat(tmp, matches->data, " ", NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4083 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4084 g_free(matches->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4085 matches = g_list_remove(matches, matches->data);
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
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4088 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
4089 time(NULL));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4090 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
4091 g_free(addthis);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4092 }
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 g_free(entered);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4095 g_free(partial);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4096
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4097 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4098 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4099
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4100 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
4101 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4102 PurplePluginProtocolInfo *prpl_info = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4103 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4104 PurpleConversation *conv = gtkconv->active_conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4105 PidginChatPane *gtkchat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4106 char *new_topic;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4107 const char *current_topic;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4108
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4109 gc = purple_conversation_get_gc(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4110
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4111 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
4112 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4113
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4114 if(prpl_info->set_chat_topic == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4115 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4116
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4117 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4118 gtkchat = gtkconv->u.chat;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4119 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
4120 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
4121
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4122 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
4123 g_free(new_topic);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4124 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4125 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4126
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4127 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
4128 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
4129 new_topic);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4130
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4131 g_free(new_topic);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4132 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4133
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4134 static gint
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4135 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
4136 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4137 PurpleConvChatBuddyFlags f1 = 0, f2 = 0;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4138 char *user1 = NULL, *user2 = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4139 gboolean buddy1 = FALSE, buddy2 = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4140 gint ret = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4141
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4142 gtk_tree_model_get(model, a,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4143 CHAT_USERS_ALIAS_KEY_COLUMN, &user1,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4144 CHAT_USERS_FLAGS_COLUMN, &f1,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4145 CHAT_USERS_WEIGHT_COLUMN, &buddy1,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4146 -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4147 gtk_tree_model_get(model, b,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4148 CHAT_USERS_ALIAS_KEY_COLUMN, &user2,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4149 CHAT_USERS_FLAGS_COLUMN, &f2,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4150 CHAT_USERS_WEIGHT_COLUMN, &buddy2,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4151 -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4152
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4153 if (user1 == NULL || user2 == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4154 if (!(user1 == NULL && user2 == NULL))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4155 ret = (user1 == NULL) ? -1: 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4156 } else if (f1 != f2) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4157 /* sort more important users first */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4158 ret = (f1 > f2) ? -1 : 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4159 } else if (buddy1 != buddy2) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4160 ret = (buddy1 > buddy2) ? -1 : 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4161 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4162 ret = strcmp(user1, user2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4163 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4164
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4165 g_free(user1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4166 g_free(user2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4167
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4168 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4169 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4170
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4171 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4172 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
4173 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4174 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4175 PurpleConvChat *chat = PURPLE_CONV_CHAT(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4176 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4177 char *normalized_name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4178 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4179 int f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4180
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4181 g_return_if_fail(buddy != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4182 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4183
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4184 /* 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
4185 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
4186
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4187 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
4188 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4189
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4190 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
4191
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4192 do {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4193 char *name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4194
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4195 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
4196
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4197 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
4198 const char *alias = name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4199 char *tmp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4200 char *alias_key = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4201 PurpleBuddy *buddy2;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4202
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4203 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
4204 /* 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
4205
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4206 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
4207 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
4208 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4209
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4210 tmp = g_utf8_casefold(alias, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4211 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
4212 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4213
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4214 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
4215 CHAT_USERS_ALIAS_COLUMN, alias,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4216 CHAT_USERS_ALIAS_KEY_COLUMN, alias_key,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4217 -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4218 g_free(alias_key);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4219 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4220 g_free(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4221 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4222 }
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 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
4225
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4226 g_free(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4227 } while (f != 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4228
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4229 g_free(normalized_name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4230 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4231
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4232 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4233 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
4234 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4235 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4236 PurplePluginProtocolInfo *prpl_info;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4237
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4238 g_return_if_fail(node != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4239 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4240
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4241 gc = purple_conversation_get_gc(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4242 g_return_if_fail(gc != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4243 g_return_if_fail(gc->prpl != NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4244 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
4245
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4246 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
4247 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4248
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4249 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
4250 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4251 PurpleBlistNode *bnode;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4252
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4253 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
4254
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4255 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
4256 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4257
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4258 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
4259 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4260 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4261 else if (PURPLE_BLIST_NODE_IS_BUDDY(node))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4262 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
4263 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
4264 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
4265 {
c30dae34dd33 Update the tab-title for chats immediately after aliasing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17106
diff changeset
4266 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
4267 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
4268 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4269 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4270
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4271 static void
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4272 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
4273 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4274 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4275 char *normalized_name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4276 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4277 int f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4278
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4279 g_return_if_fail(buddy != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4280 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4281
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4282 /* 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
4283 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
4284 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4285
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4286 /* 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
4287 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
4288
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4289 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
4290 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4291
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4292 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
4293
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4294 do {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4295 char *name;
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 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
4298
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4299 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
4300 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
4301 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
4302 g_free(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4303 break;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4306 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
4307
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4308 g_free(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4309 } while (f != 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4310
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4311 g_free(normalized_name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4312
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4313 blist_node_aliased_cb((PurpleBlistNode *)buddy, NULL, conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4314 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4315
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4316 static void
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4317 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
4318 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4319 buddy_cb_common(buddy, conv, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4320 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4321
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4322 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4323 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
4324 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4325 /* 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
4326 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
4327 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4328
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4329 buddy_cb_common(buddy, conv, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4330 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4331
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4332 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
4333 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4334 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
4335 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4336
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4337 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4338 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
4339 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4340 GtkWidget *menuitem;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4341 PidginConversation *gtkconv = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4342
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4343 g_return_if_fail(menu != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4344 g_return_if_fail(gtkconv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4345
15560
442128853bdb toolbar/menu icons. reduce the imhtmltoolbar spacing. more gaimstock pruning
Sean Egan <seanegan@gmail.com>
parents: 15557
diff changeset
4346 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
4347 G_CALLBACK(send_menu_cb), gtkconv,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4348 0, 0, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4349 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
4350 gtk_widget_set_sensitive(menuitem, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4351 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
4352
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4353 menuitem = gtk_separator_menu_item_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4354 gtk_widget_show(menuitem);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4355 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
4356 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4357
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
4358 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
4359 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4360 GtkTextBuffer *buffer;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4361 GtkTextIter iter;
20837
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4362 int wrapped_lines;
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4363 int lines;
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4364 GdkRectangle oneline;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4365 GtkRequisition sr;
20838
effa512ad24a fix the auto resize code for the showing formatting toolbar case, which
Ka-Hing Cheung <khc@hxbc.us>
parents: 20837
diff changeset
4366 int height, diff;
20837
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4367 int pad_top, pad_inside, pad_bottom;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4368
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4369 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
4370
20837
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4371 wrapped_lines = 1;
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4372 gtk_text_buffer_get_start_iter(buffer, &iter);
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4373 gtk_text_view_get_iter_location(GTK_TEXT_VIEW(gtkconv->entry), &iter, &oneline);
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4374 while (gtk_text_view_forward_display_line(GTK_TEXT_VIEW(gtkconv->entry), &iter))
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4375 wrapped_lines++;
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4376
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4377 lines = gtk_text_buffer_get_line_count(buffer);
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4378
21848
8a52e4cf64c5 I noticed that the new added padding in gtkconv has the same effect as an extra line of text, so I'm removing the MAX(2 bit
Sean Egan <seanegan@gmail.com>
parents: 21840
diff changeset
4379 /* Show a maximum of 4 lines */
8a52e4cf64c5 I noticed that the new added padding in gtkconv has the same effect as an extra line of text, so I'm removing the MAX(2 bit
Sean Egan <seanegan@gmail.com>
parents: 21840
diff changeset
4380 lines = MIN(lines, 4);
21825
9bdfeeea9145 Another tweak to the auto-resizing so it shows new empty lines correctly,
Stu Tomlinson <stu@nosnilmot.com>
parents: 21823
diff changeset
4381 wrapped_lines = MIN(MAX(wrapped_lines, 2), 4);
20837
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4382
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4383 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
4384 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
4385 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
4386
21825
9bdfeeea9145 Another tweak to the auto-resizing so it shows new empty lines correctly,
Stu Tomlinson <stu@nosnilmot.com>
parents: 21823
diff changeset
4387 height = (oneline.height + pad_top + pad_bottom) * lines;
9bdfeeea9145 Another tweak to the auto-resizing so it shows new empty lines correctly,
Stu Tomlinson <stu@nosnilmot.com>
parents: 21823
diff changeset
4388 if (wrapped_lines > lines)
9bdfeeea9145 Another tweak to the auto-resizing so it shows new empty lines correctly,
Stu Tomlinson <stu@nosnilmot.com>
parents: 21823
diff changeset
4389 height += (oneline.height + pad_inside) * (wrapped_lines - lines);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4390
18631
462737382c64 Better imhtml auto-growing. Fixes #214
Sean Egan <seanegan@gmail.com>
parents: 18625
diff changeset
4391 gtkconv->auto_resize = TRUE;
20837
ccb728fa5af8 fix up the aweful spacing here
Ka-Hing Cheung <khc@hxbc.us>
parents: 20834
diff changeset
4392 g_idle_add(reset_auto_resize_cb, gtkconv);
20838
effa512ad24a fix the auto resize code for the showing formatting toolbar case, which
Ka-Hing Cheung <khc@hxbc.us>
parents: 20837
diff changeset
4393
20839
83b662c458de uses the entry's allocated height instead of requested height, works around
Ka-Hing Cheung <khc@hxbc.us>
parents: 20838
diff changeset
4394 diff = height - gtkconv->entry->allocation.height;
20838
effa512ad24a fix the auto resize code for the showing formatting toolbar case, which
Ka-Hing Cheung <khc@hxbc.us>
parents: 20837
diff changeset
4395
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4396 gtk_widget_size_request(gtkconv->lower_hbox, &sr);
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
4397 gtkconv->entry_growing = TRUE;
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
4398
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
4399 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
4400 diff + gtkconv->lower_hbox->allocation.height);
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
4401 return FALSE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4402 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4403
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4404 static void
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4405 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
4406 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4407 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
4408 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
4409 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
4410 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
4411 {
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4412 GtkWidget *hbox, *label;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4413 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
4414
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
4415 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
4416 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
4417
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4418 label = gtk_label_new(_("Topic:"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4419 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
4420
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4421 gtkchat->topic_text = gtk_entry_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4422
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4423 if(prpl_info->set_chat_topic == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4424 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
4425 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4426 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
4427 G_CALLBACK(topic_callback), gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4428 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4429
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4430 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
4431 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
4432 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
4433 }
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4434 }
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4435
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
4436 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
4437 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
4438 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
4439 {
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4440 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
4441 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
4442 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
4443 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
4444 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
4445 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
4446 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
4447 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
4448
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4449 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
4450 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
4451
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4452 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
4453 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
4454
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4455 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
4456
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4457 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
4458 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
4459 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
4460 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
4461
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4462 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
4463 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
4464 }
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
4465
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4466 static void
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4467 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
4468 {
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4469 PidginChatPane *gtkchat = gtkconv->u.chat;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4470 GtkWidget *lbox, *sw, *list;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4471 GtkListStore *ls;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4472 GtkCellRenderer *rend;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4473 GtkTreeViewColumn *col;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4474 int ul_width;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4475 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
4476 PurpleConversation *conv = gtkconv->active_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4477
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4478 /* Build the right pane. */
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
4479 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
4480 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
4481 gtk_widget_show(lbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4482
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4483 /* 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
4484 gtkchat->count = gtk_label_new(_("0 people in room"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4485 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
4486 gtk_widget_show(gtkchat->count);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4487
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4488 /* Setup the list of users. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4489 sw = gtk_scrolled_window_new(NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4490 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
4491 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4492 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
4493 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
4494 gtk_widget_show(sw);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4495
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4496 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
4497 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
4498 GDK_TYPE_COLOR, G_TYPE_INT);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4499 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
4500 sort_chat_users, NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4501
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4502 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
4503
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4504 rend = gtk_cell_renderer_pixbuf_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4505
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4506 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
4507 "pixbuf", CHAT_USERS_ICON_COLUMN, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4508 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
4509 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
4510 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
4511 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
4512
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
4513 /* 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
4514 * 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
4515 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
4516 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
4517
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4518 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
4519 G_CALLBACK(right_click_chat_cb), gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4520 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
4521 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
4522 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
4523
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
4524 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
4525 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
4526
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4527 rend = gtk_cell_renderer_text_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4528 g_object_set(rend,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4529 "foreground-set", TRUE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4530 "weight-set", TRUE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4531 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
4532 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
4533
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4534 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
4535 "text", CHAT_USERS_ALIAS_COLUMN,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4536 "foreground-gdk", CHAT_USERS_COLOR_COLUMN,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4537 "weight", CHAT_USERS_WEIGHT_COLUMN,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4538 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4539
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4540 purple_signal_connect(blist_handle, "buddy-added",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4541 gtkchat, PURPLE_CALLBACK(buddy_added_cb), conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4542 purple_signal_connect(blist_handle, "buddy-removed",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4543 gtkchat, PURPLE_CALLBACK(buddy_removed_cb), conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4544 purple_signal_connect(blist_handle, "blist-node-aliased",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4545 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
4546
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4547 #if GTK_CHECK_VERSION(2,6,0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4548 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
4549 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
4550 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4551
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4552 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
4553
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4554 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
4555 gtk_widget_show(list);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4556
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4557 gtkchat->list = list;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4558
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4559 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
4560 }
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4561
18671
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4562 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
4563 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
4564 {
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4565 PurpleBlistNode *node = NULL;
19227
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4566 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
4567 PidginConversation *gtkconv = userdata;
19227
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4568
ae0f058f604e Fix a crash regarding tooltips on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19226
diff changeset
4569 conv = gtkconv->active_conv;
19226
a0d45fa8ecfc De-seaneganify some of the indentation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19223
diff changeset
4570 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
4571 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
4572 #if 0
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4573 /* Using the transient blist nodes to show the tooltip doesn't quite work yet. */
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4574 if (!node)
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4575 node = g_object_get_data(G_OBJECT(gtkconv->imhtml), "transient_chat");
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4576 #endif
18671
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4577 } else {
19226
a0d45fa8ecfc De-seaneganify some of the indentation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19223
diff changeset
4578 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
4579 #if 0
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4580 if (!node)
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4581 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
4582 #endif
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4583 }
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4584
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
4585 if (node)
18671
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4586 pidgin_blist_draw_tooltip(node, gtkconv->infopane);
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4587 return FALSE;
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4588 }
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4589
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4590 static GtkWidget *
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4591 setup_common_pane(PidginConversation *gtkconv)
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4592 {
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
4593 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
4594 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
4595 GtkTreePath *path;
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4596 PurpleConversation *conv = gtkconv->active_conv;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4597 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
4598 GtkPolicyType imhtml_sw_hscroll;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4599
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4600 /* 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
4601 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
4602 gtk_widget_show(vbox);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4603
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
4604 /* 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
4605 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
4606 #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
4607 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
4608 #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
4609 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
4610 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
4611 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
4612 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
4613 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
4614 gtk_widget_add_events(event_box,
18671
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
4615 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
4616 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
4617 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
4618
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
4619 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
4620 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
4621
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
4622 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
4623 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
4624 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
4625 GTK_TREE_MODEL(gtkconv->infopane_model));
18181
a8c701d877aa Start work on blist pane in conversation. Looks like: http://pidgin.im/~seanegan/infopane.png Certainly much to be done yet.
Sean Egan <seanegan@gmail.com>
parents: 18167
diff changeset
4626 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
4627 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
4628 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
4629 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
4630 gtk_tree_path_free(path);
19306
16cad7ba399c Set size request on infopane's hbox instead of hbox itself. This way, when we hide the hbox to edit, the pane remains 32px tall
Sean Egan <seanegan@gmail.com>
parents: 19293
diff changeset
4631 gtk_widget_set_size_request(gtkconv->infopane_hbox, -1, 32);
18181
a8c701d877aa Start work on blist pane in conversation. Looks like: http://pidgin.im/~seanegan/infopane.png Certainly much to be done yet.
Sean Egan <seanegan@gmail.com>
parents: 18167
diff changeset
4632 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
4633
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
4634 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
4635 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
4636 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
4637 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
4638
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
4639 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
4640 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
4641 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
4642 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
4643
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
4644 #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
4645 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
4646 #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
4647
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
4648 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
4649 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
4650 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
4651 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
4652
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
4653 rend = gtk_cell_renderer_pixbuf_new();
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
4654 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
4655 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
4656 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
4657
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4658 /* Setup the gtkimhtml widget */
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4659 frame = pidgin_create_imhtml(FALSE, &gtkconv->imhtml, NULL, &imhtml_sw);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4660 if (chat) {
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4661 GtkWidget *hpaned;
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4662
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4663 /* Add the topic */
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4664 setup_chat_topic(gtkconv, vbox);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4665
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4666 /* Add the gtkimhtml frame */
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4667 hpaned = gtk_hpaned_new();
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4668 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
4669 gtk_widget_show(hpaned);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4670 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
4671
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4672 /* Now add the userlist */
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4673 setup_chat_userlist(gtkconv, hpaned);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4674 } else {
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4675 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
4676 }
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4677 gtk_widget_show(frame);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4678
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4679 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
4680 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
4681
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4682 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
4683 &imhtml_sw_hscroll, NULL);
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4684 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
4685 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
4686
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4687 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
4688 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
4689 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
4690 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
4691 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
4692 G_CALLBACK(refocus_entry_cb), gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4693
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
4694 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
4695 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
4696 gtk_widget_show(gtkconv->lower_hbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4697
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4698 /* 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
4699 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
4700 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
4701 gtk_widget_show(frame);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4702
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
4703 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
4704 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
4705 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
4706
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4707 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
4708 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
4709 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
4710 G_CALLBACK(entry_key_press_cb), gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4711 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
4712 G_CALLBACK(send_cb), gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4713 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
4714 G_CALLBACK(entry_stop_rclick_cb), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4715
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4716 gtkconv->entry_buffer =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4717 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
4718 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
4719
17399
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4720 if (!chat) {
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4721 /* 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
4722 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
4723 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
4724 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
4725 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
4726 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
4727 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
4728 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
4729 }
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4730
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4731 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
4732 G_CALLBACK(resize_imhtml_cb), gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4733
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4734 default_formatize(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4735 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
4736 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
4737 return vbox;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4738 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4739
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4740 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4741 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
4742 GtkSelectionData *sd, guint info, guint t,
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4743 PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4744 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4745 PurpleConversation *conv = gtkconv->active_conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4746 PidginWindow *win = gtkconv->win;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4747 PurpleConversation *c;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4748 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
4749 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4750 PurpleBlistNode *n = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4751 PurpleBuddy *b;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4752 PidginConversation *gtkconv = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4753
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4754 n = *(PurpleBlistNode **)sd->data;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4755
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4756 if (PURPLE_BLIST_NODE_IS_CONTACT(n))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4757 b = purple_contact_get_priority_buddy((PurpleContact*)n);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4758 else if (PURPLE_BLIST_NODE_IS_BUDDY(n))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4759 b = (PurpleBuddy*)n;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4760 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4761 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4762
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4763 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4764 * 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
4765 * 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
4766 * conv and add it to this window.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4767 */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4768 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
4769 if (c != NULL) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4770 PidginWindow *oldwin;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4771 gtkconv = PIDGIN_CONVERSATION(c);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4772 oldwin = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4773 if (oldwin != win) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4774 pidgin_conv_window_remove_gtkconv(oldwin, gtkconv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4775 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
4776 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4777 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4778 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
4779 gtkconv = PIDGIN_CONVERSATION(c);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4780 if (gtkconv->win != win)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4781 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4782 pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4783 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
4784 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4785 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4786
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4787 /* Make this conversation the active conversation */
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4788 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
4789
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4790 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
4791 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4792 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
4793 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4794 char *protocol = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4795 char *username = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4796 PurpleAccount *account;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4797 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4798
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4799 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
4800 &protocol, &username, NULL))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4801 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4802 if (account == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4803 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4804 purple_notify_error(win, NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4805 _("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
4806 "can add that buddy."), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4807 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4808 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4809 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4810 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
4811 gtkconv = PIDGIN_CONVERSATION(c);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4812 if (gtkconv->win != win)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4813 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4814 pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4815 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
4816 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4817 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4818 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4819
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4820 g_free(username);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4821 g_free(protocol);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4822
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4823 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
4824 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4825 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
4826 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
4827 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
4828 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
4829 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4830 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4831 gtk_drag_finish(dc, FALSE, FALSE, t);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4832 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4833
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4834
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4835 static const GtkTargetEntry te[] =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4836 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4837 GTK_IMHTML_DND_TARGETS,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4838 {"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
4839 {"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
4840 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4841
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4842 static PidginConversation *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4843 pidgin_conv_find_gtkconv(PurpleConversation * conv)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4844 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4845 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
4846 PurpleContact *c;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4847 PurpleBlistNode *cn;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4848
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4849 if (!bud)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4850 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4851
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4852 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
4853 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4854
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4855 cn = (PurpleBlistNode *)c;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4856 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
4857 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4858 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
4859 if (conv->ui_data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4860 return conv->ui_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4861 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4862 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4863
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4864 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4865 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4866
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4867 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4868 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
4869 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4870 GList *list;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4871
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4872 g_return_if_fail(bnode);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4873 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
4874
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4875 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
4876 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4877 PidginWindow *win = list->data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4878 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
4879
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4880 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
4881 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4882
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
4883 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
4884 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4885 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4886
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
4887 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
4888 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
4889 {
b079dad9d569 Stop propagating a middle-click on the pane-handle to the notebook below.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17107
diff changeset
4890 /* 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
4891 * 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
4892 * 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
4893 */
b079dad9d569 Stop propagating a middle-click on the pane-handle to the notebook below.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17107
diff changeset
4894 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
4895 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
4896 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
4897 }
b079dad9d569 Stop propagating a middle-click on the pane-handle to the notebook below.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17107
diff changeset
4898
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4899 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4900 * Conversation UI operations
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4901 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4902 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4903 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
4904 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4905 PidginConversation *gtkconv;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4906 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
4907 GtkWidget *pane = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4908 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
4909 PurpleBlistNode *convnode;
22009
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
4910 PurpleValue *value;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4911
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4912 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
4913 conv->ui_data = gtkconv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4914 if (!g_list_find(gtkconv->convs, conv))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4915 gtkconv->convs = g_list_prepend(gtkconv->convs, conv);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
4916 pidgin_conv_switch_active_conversation(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4917 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4918 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4919
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4920 gtkconv = g_new0(PidginConversation, 1);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4921 conv->ui_data = gtkconv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4922 gtkconv->active_conv = conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4923 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
4924 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
4925
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4926 /* Setup some initial variables. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4927 gtkconv->tooltips = gtk_tooltips_new();
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
4928 gtkconv->unseen_state = PIDGIN_UNSEEN_NONE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4929 gtkconv->unseen_count = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4930
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4931 if (conv_type == PURPLE_CONV_TYPE_IM) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4932 gtkconv->u.im = g_malloc0(sizeof(PidginImPane));
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4933 } 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
4934 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
4935 }
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4936 pane = setup_common_pane(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4937
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4938 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
4939 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
4940
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4941 if (pane == NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4942 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
4943 g_free(gtkconv->u.chat);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4944 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
4945 g_free(gtkconv->u.im);
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 g_free(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4948 conv->ui_data = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4949 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4950 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4951
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4952 /* Setup drag-and-drop */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4953 gtk_drag_dest_set(pane,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4954 GTK_DEST_DEFAULT_MOTION |
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4955 GTK_DEST_DEFAULT_DROP,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4956 te, sizeof(te) / sizeof(GtkTargetEntry),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4957 GDK_ACTION_COPY);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4958 gtk_drag_dest_set(pane,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4959 GTK_DEST_DEFAULT_MOTION |
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4960 GTK_DEST_DEFAULT_DROP,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4961 te, sizeof(te) / sizeof(GtkTargetEntry),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4962 GDK_ACTION_COPY);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4963 gtk_drag_dest_set(gtkconv->imhtml, 0,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4964 te, sizeof(te) / sizeof(GtkTargetEntry),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4965 GDK_ACTION_COPY);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4966
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4967 gtk_drag_dest_set(gtkconv->entry, 0,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4968 te, sizeof(te) / sizeof(GtkTargetEntry),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4969 GDK_ACTION_COPY);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4970
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
4971 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
4972 G_CALLBACK(ignore_middle_click), NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4973 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
4974 G_CALLBACK(conv_dnd_recv), gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4975 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
4976 G_CALLBACK(conv_dnd_recv), gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4977 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
4978 G_CALLBACK(conv_dnd_recv), gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4979
21875
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
4980 gtk_text_buffer_create_tag(GTK_IMHTML(gtkconv->imhtml)->text_buffer, "TYPING-NOTIFICATION",
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
4981 "foreground", "#888888",
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
4982 "justification", GTK_JUSTIFY_LEFT, /* XXX: RTL'ify */
21897
a64a7bc69f42 Avoid jumpiness when typing notification in the conv. history is removed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21896
diff changeset
4983 "weight", PANGO_WEIGHT_BOLD,
a64a7bc69f42 Avoid jumpiness when typing notification in the conv. history is removed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21896
diff changeset
4984 "scale", PANGO_SCALE_SMALL,
a64a7bc69f42 Avoid jumpiness when typing notification in the conv. history is removed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21896
diff changeset
4985 NULL);
21875
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
4986
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4987 /* Setup the container for the tab. */
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
4988 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
4989 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
4990 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
4991 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
4992 gtk_widget_show(pane);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4993
19980
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
4994 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
4995 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
4996 gtkconv->make_sound = TRUE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4997
22009
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
4998 if (convnode != NULL &&
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
4999 (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
5000 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
5001 {
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
5002 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
5003 }
1494e0a0f2b9 Save the conversation "Enable Logging" option per-contact.
Moos Heintzen <iwasroot@gmail.com>
parents: 21951
diff changeset
5004
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
5005 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
5006 gtk_widget_show(gtkconv->toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5007 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5008 gtk_widget_hide(gtkconv->toolbar);
21665
baa25b613999 Clean up warnings
Sean Egan <seanegan@gmail.com>
parents: 21664
diff changeset
5009 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
5010
18602
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
5011 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
5012 gtk_widget_show(gtkconv->infopane_hbox);
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
5013 else
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
5014 gtk_widget_hide(gtkconv->infopane_hbox);
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
5015
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5016 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
5017 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
5018 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
5019 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
5020
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5021 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
5022 G_CALLBACK(gtk_widget_grab_focus),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5023 gtkconv->entry);
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 if (hidden)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5026 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
5027 else
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
5028 pidgin_conv_placement_place(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5029
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5030 if (nick_colors == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5031 nbr_nick_colors = NUM_NICK_COLORS;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5032 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
5033 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5034 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5035
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5036 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5037 pidgin_conv_new_hidden(PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5038 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5039 private_gtkconv_new(conv, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5040 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5041
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5042 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5043 pidgin_conv_new(PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5044 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5045 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
5046 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
5047 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
5048 "conversation-displayed", PIDGIN_CONVERSATION(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5049 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5050
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5051 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5052 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
5053 PurpleConversation *conv, PurpleMessageFlags flags)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5054 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5055 PurpleConversationUiOps *ui_ops = pidgin_conversations_get_conv_ui_ops();
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5056 gboolean hide = FALSE;
19897
922960f829f9 disapproval of revision '08f542359200866bb7a302653d875cdeccb8df01'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
5057
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5058 /* 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
5059 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
5060 hide = TRUE;
19897
922960f829f9 disapproval of revision '08f542359200866bb7a302653d875cdeccb8df01'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
5061
922960f829f9 disapproval of revision '08f542359200866bb7a302653d875cdeccb8df01'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
5062 /* 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
5063 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
5064 !purple_status_is_available(purple_account_get_active_status(account)))
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5065 hide = TRUE;
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5066
21772
21371ea85970 Fix boldifying the chat entries in the buddylist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21766
diff changeset
5067 if (conv && PIDGIN_IS_PIDGIN_CONVERSATION(conv) && !hide) {
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5068 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5069 if (gtkconv->win == hidden_convwin) {
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5070 pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv);
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5071 pidgin_conv_placement_place(gtkconv);
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5072 }
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5073 return;
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5074 }
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5075
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5076 if (hide) {
19897
922960f829f9 disapproval of revision '08f542359200866bb7a302653d875cdeccb8df01'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
5077 ui_ops->create_conversation = pidgin_conv_new_hidden;
922960f829f9 disapproval of revision '08f542359200866bb7a302653d875cdeccb8df01'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
5078 purple_conversation_new(PURPLE_CONV_TYPE_IM, account, sender);
922960f829f9 disapproval of revision '08f542359200866bb7a302653d875cdeccb8df01'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
5079 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
5080 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5081 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5082
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5083 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5084 pidgin_conv_destroy(PurpleConversation *conv)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5085 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5086 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5087
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5088 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
5089 /* 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
5090 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
5091 /* 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
5092 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
5093 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
5094 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
5095 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5096 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
5097 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5098
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5099 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
5100
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5101 /* 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
5102 purple_request_close_with_handle(gtkconv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5103 purple_notify_close_with_handle(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5104
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5105 gtk_widget_destroy(gtkconv->tab_cont);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5106 g_object_unref(gtkconv->tab_cont);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5107
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5108 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
5109 if (gtkconv->u.im->icon_timer != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5110 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
5111
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5112 if (gtkconv->u.im->anim != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5113 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
5114
16273
143b508024c0 Patch from khc to remove the typing notifcation callback when the window is
Stu Tomlinson <stu@nosnilmot.com>
parents: 16229
diff changeset
5115 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
5116 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
5117
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5118 g_free(gtkconv->u.im);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5119 } 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
5120 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
5121 g_free(gtkconv->u.chat);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5122 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5123
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5124 gtk_object_sink(GTK_OBJECT(gtkconv->tooltips));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5125
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5126 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
5127 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
5128 g_list_free(gtkconv->send_history);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5129
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
5130 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
5131 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
5132 }
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
5133
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5134 g_free(gtkconv);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5137
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5138 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5139 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
5140 const char *message, PurpleMessageFlags flags,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5141 time_t mtime)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5142 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5143 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5144
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5145 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5146
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5147 if (conv != gtkconv->active_conv &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5148 flags & PURPLE_MESSAGE_ACTIVE_ONLY)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5149 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5150 /* 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
5151 * 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
5152 * before being written to the log. */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5153 purple_debug_info("gtkconv",
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
5154 "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
5155 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5156 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5157
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5158 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
5159 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5160
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5161 /* 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
5162 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
5163 GdkEvent *event, GtkTextIter *arg2, gpointer data) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5164 if (event->type == GDK_BUTTON_PRESS
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5165 || event->type == GDK_2BUTTON_PRESS) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5166 GdkEventButton *btn_event = (GdkEventButton*) event;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5167 PurpleConversation *conv = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5168 char *buddyname;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5169
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5170 /* strlen("BUDDY ") == 6 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5171 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
5172 && (strlen(tag->name) > 6), FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5173
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5174 buddyname = (tag->name) + 6;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5175
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5176 if (btn_event->button == 2
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5177 && event->type == GDK_2BUTTON_PRESS) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5178 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
5179
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5180 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5181 } else if (btn_event->button == 3
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5182 && event->type == GDK_BUTTON_PRESS) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5183 GtkTextIter start, end;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5184
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5185 /* we shouldn't display the popup
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5186 * if the user has selected something: */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5187 if (!gtk_text_buffer_get_selection_bounds(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5188 gtk_text_iter_get_buffer(arg2),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5189 &start, &end)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5190 GtkWidget *menu = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5191 PurpleConnection *gc =
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5192 purple_conversation_get_gc(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5193
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5194
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5195 menu = create_chat_menu(conv, buddyname, gc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5196 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
5197 NULL, GTK_WIDGET(imhtml),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5198 btn_event->button,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5199 btn_event->time);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5200
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5201 /* Don't propagate the event any further */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5202 return TRUE;
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5205 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5206
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5207 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5208 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5209
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5210 static GtkTextTag *get_buddy_tag(PurpleConversation *conv, const char *who) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5211 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5212 GtkTextTag *buddytag;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5213 gchar *str;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5214
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5215 str = g_strdup_printf("BUDDY %s", who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5216
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5217 buddytag = gtk_text_tag_table_lookup(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5218 gtk_text_buffer_get_tag_table(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5219 GTK_IMHTML(gtkconv->imhtml)->text_buffer), str);
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 if (buddytag == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5222 buddytag = gtk_text_buffer_create_tag(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5223 GTK_IMHTML(gtkconv->imhtml)->text_buffer, str, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5224
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5225 g_signal_connect(G_OBJECT(buddytag), "event",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5226 G_CALLBACK(buddytag_event), conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5227 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5228
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5229 g_free(str);
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 return buddytag;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5232 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5233
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
5234 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
5235 {
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5236 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
5237
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5238 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
5239 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
5240
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5241 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
5242 }
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5243
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5244 /* 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
5245 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
5246 static void
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5247 str_embed_direction_chars(char **str)
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5248 {
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
5249 #ifdef HAVE_PANGO14
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5250 char pre_str[4];
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5251 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
5252 char *ret;
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5253
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5254 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
5255 {
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
5256 sprintf(pre_str, "%c%c%c",
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5257 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
5258 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
5259 0xE2, 0x80, 0xAC, /* PDF */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5260 0xE2, 0x80, 0x8E, /* LRM */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5261 0xE2, 0x80, 0xAC); /* PDF */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5262 }
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5263 else
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5264 {
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
5265 sprintf(pre_str, "%c%c%c",
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5266 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
5267 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
5268 0xE2, 0x80, 0xAC, /* PDF */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5269 0xE2, 0x80, 0x8F, /* RLM */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5270 0xE2, 0x80, 0xAC); /* PDF */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5271 }
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5272
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
5273 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
5274
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5275 g_free(*str);
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5276 *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
5277 #endif
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5278 }
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5279
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5280 /* 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
5281 static gboolean
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5282 html_is_rtl(const char *html)
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5283 {
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5284 GData *attributes;
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5285 const gchar *start, *end;
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5286 gboolean res = FALSE;
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5287
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5288 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
5289 {
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5290 /* 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
5291 const char *tmp = g_datalist_get_data(&attributes, "dir");
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5292 if (tmp && !g_ascii_strcasecmp(tmp, "RTL"))
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5293 res = TRUE;
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5294 if (!res)
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5295 {
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5296 tmp = g_datalist_get_data(&attributes, "style");
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5297 if (tmp)
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5298 {
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5299 char *tmp2 = purple_markup_get_css_property(tmp, "direction");
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5300 if (tmp2 && !g_ascii_strcasecmp(tmp2, "RTL"))
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5301 res = TRUE;
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5302 g_free(tmp2);
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5303 }
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5304
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5305 }
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5306 g_datalist_clear(&attributes);
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5307 }
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5308 return res;
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5309 }
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5310
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5311
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5312 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5313 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
5314 const char *message, PurpleMessageFlags flags,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5315 time_t mtime)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5316 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5317 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5318 PidginWindow *win;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5319 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5320 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5321 PurplePluginProtocolInfo *prpl_info;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5322 int gtk_font_options = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5323 int gtk_font_options_all = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5324 int max_scrollback_lines;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5325 int line_count;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5326 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
5327 gboolean show_date;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5328 char *mdate;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5329 char color[10];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5330 char *str;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5331 char *with_font_tag;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5332 char *sml_attrib = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5333 size_t length;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5334 PurpleConversationType type;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5335 char *displaying;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5336 gboolean plugin_return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5337 char *bracket;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5338 int tag_count = 0;
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5339 gboolean is_rtl_message = FALSE;
16964
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5340 GtkSmileyTree *tree = NULL;
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5341 GHashTable *smiley_data = NULL;
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
5342
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5343 g_return_if_fail(conv != NULL);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5344 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5345 g_return_if_fail(gtkconv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5346
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
5347 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
5348 /* 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
5349 * 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
5350 * 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
5351 * 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
5352 */
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
5353 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
5354 }
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
5355
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5356 if (conv != gtkconv->active_conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5357 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5358 if (flags & PURPLE_MESSAGE_ACTIVE_ONLY)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5359 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5360 /* 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
5361 * 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
5362 * 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
5363 * purple_conversation_write(). */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5364 purple_debug_info("gtkconv",
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
5365 "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
5366 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5367 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5368
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5369 /* 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
5370 /* 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
5371 if (flags & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV))
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
5372 pidgin_conv_switch_active_conversation(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5373 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5374
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5375 type = purple_conversation_get_type(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5376 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5377 g_return_if_fail(account != NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5378 gc = purple_account_get_connection(account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5379 g_return_if_fail(gc != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5380
15579
74b945e7609c Moved linkification of incoming messages to pidgin_conv_write_conv()
Evan Schoenberg <evan.s@dreskin.net>
parents: 15560
diff changeset
5381 /* 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
5382 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
5383 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
5384 else
7790021b1270 add a PURPLE_MESSAGE_NO_LINKIFY to prevent things from getting linkified
Nathan Walp <nwalp@pidgin.im>
parents: 18024
diff changeset
5385 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
5386
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5387 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
5388 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
5389 "displaying-im-msg" : "displaying-chat-msg"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5390 account, name, &displaying, conv, flags));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5391 if (plugin_return)
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 g_free(displaying);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5394 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5395 }
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5396 length = strlen(displaying) + 1;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5397
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5398 /* 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
5399 * 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
5400 * needs that much formatting, anyway.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5401 */
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5402 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
5403 tag_count++;
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5404
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5405 if (tag_count > 100) {
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5406 char *tmp = displaying;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5407 displaying = purple_markup_strip_html(tmp);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5408 g_free(tmp);
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5409 }
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5410
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5411 win = gtkconv->win;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5412 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
5413
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5414 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
5415 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
5416 gtkconv->imhtml)));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5417
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5418 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
5419 PIDGIN_PREFS_ROOT "/conversations/scrollback_lines");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5420 /* 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
5421 max scrollback, trim down to max scrollback */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5422 if (max_scrollback_lines > 0
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5423 && line_count > (max_scrollback_lines + 100)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5424 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
5425 GTK_TEXT_VIEW(gtkconv->imhtml));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5426 GtkTextIter start, end;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5427
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5428 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
5429 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
5430 (line_count - max_scrollback_lines));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5431 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
5432 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5433
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5434 if (type == PURPLE_CONV_TYPE_CHAT)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5435 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5436 /* Create anchor for user */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5437 GtkTextIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5438 char *tmp = g_strconcat("user:", name, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5439
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5440 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
5441 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
5442 tmp, &iter, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5443 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5444 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5445
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
5446 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
5447 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
5448
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5449 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
5450 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
5451
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
5452 /* 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
5453 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
5454 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
5455
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5456 /* 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
5457 * 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
5458 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
5459
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5460 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
5461 "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
5462 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
5463
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5464 if (mdate == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5465 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5466 struct tm *tm = localtime(&mtime);
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5467 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
5468 if (show_date)
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5469 tmp = purple_date_format_long(tm);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5470 else
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5471 tmp = purple_time_format(tm);
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5472 mdate = g_strdup_printf("(%s)", tmp);
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
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5475 /* 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
5476 is_rtl_message = html_is_rtl(message);
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5477 /* Enforce direction only if message is RTL - doesn't effect LTR users */
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5478 if (is_rtl_message)
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5479 str_embed_direction_chars(&mdate);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5480
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
5481 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
5482 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
5483
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5484 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
5485
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5486 gtk_font_options |= GTK_IMHTML_NO_COMMENTS;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5487
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5488 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
5489 !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
5490 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
5491
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5492 /* 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
5493 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
5494 OPT_PROTO_USE_POINTSIZE) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5495 gtk_font_options |= GTK_IMHTML_USE_POINTSIZE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5496 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5497
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
5498 if (!(flags & PURPLE_MESSAGE_RECV))
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5499 {
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
5500 /* Temporarily revert to the original smiley-data to avoid showing up
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5501 * custom smileys of the buddy when sending message
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5502 */
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
5503 tree = GTK_IMHTML(gtkconv->imhtml)->default_smilies;
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5504 GTK_IMHTML(gtkconv->imhtml)->default_smilies =
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5505 GTK_IMHTML(gtkconv->entry)->default_smilies;
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5506 smiley_data = GTK_IMHTML(gtkconv->imhtml)->smiley_data;
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5507 GTK_IMHTML(gtkconv->imhtml)->smiley_data = GTK_IMHTML(gtkconv->entry)->smiley_data;
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5508 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5509
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5510 /* 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
5511 if (flags & PURPLE_MESSAGE_RAW) {
15602
b03021cef5cb SF Patch #1653845 from Matt Perry
Richard Laager <rlaager@wiktel.com>
parents: 15579
diff changeset
5512 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
5513 } else if (flags & PURPLE_MESSAGE_SYSTEM) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5514 g_snprintf(buf2, sizeof(buf2),
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5515 "<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
5516 sml_attrib ? sml_attrib : "", mdate, displaying);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5517
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5518 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
5519
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5520 } else if (flags & PURPLE_MESSAGE_ERROR) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5521 g_snprintf(buf2, sizeof(buf2),
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5522 "<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
5523 sml_attrib ? sml_attrib : "", mdate, displaying);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5524
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5525 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
5526
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5527 } 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
5528 g_snprintf(buf2, BUF_LONG,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5529 "<B><FONT %s COLOR=\"#777777\">%s</FONT></B>",
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5530 sml_attrib ? sml_attrib : "", displaying);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5531
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5532 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
5533 } else {
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5534 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
5535 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
5536 /* The initial offset is to deal with
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5537 * escaped entities making the string longer */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5538 int tag_start_offset = alias ? (strlen(alias_escaped) - strlen(alias)) : 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5539 int tag_end_offset = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5540
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5541 /* Enforce direction on alias */
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5542 if (is_rtl_message)
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5543 str_embed_direction_chars(&alias_escaped);
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
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_WHISPER) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5546 str = g_malloc(1024);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5547
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5548 /* 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
5549 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
5550 g_snprintf(str, 1024, "***%s", alias_escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5551 strcpy(color, "#6C2585");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5552 tag_start_offset += 3;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5553 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5554 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5555 g_snprintf(str, 1024, "*%s*:", alias_escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5556 tag_start_offset += 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5557 tag_end_offset = 2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5558 strcpy(color, "#00FF00");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5559 }
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 else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5562 if (purple_message_meify(new_message, -1)) {
21840
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5563 GdkColor *col;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5564 str = g_malloc(1024);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5565
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5566 if (flags & PURPLE_MESSAGE_AUTO_RESP) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5567 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, alias_escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5568 tag_start_offset += 4
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5569 + strlen(AUTO_RESPONSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5570 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5571 g_snprintf(str, 1024, "***%s", alias_escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5572 tag_start_offset += 3;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5573 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5574
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5575 if (flags & PURPLE_MESSAGE_NICK)
21840
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5576 gtk_widget_style_get(GTK_WIDGET(gtkconv->imhtml), "highlight-name-color", &col, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5577 else
21840
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5578 gtk_widget_style_get(GTK_WIDGET(gtkconv->imhtml), "action-name-color", &col, NULL);
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5579
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5580 if(col) {
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5581 g_snprintf(color, sizeof(color), "#%02X%02X%02X",
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5582 col->red >> 8, col->green >> 8, col->blue >> 8);
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5583 }
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5584 else {
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5585 if (flags & PURPLE_MESSAGE_NICK)
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5586 strcpy(color, DEFAULT_HIGHLIGHT_COLOR);
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5587 else
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5588 strcpy(color, DEFAULT_ACTION_COLOR);
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5589 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5590 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5591 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5592 str = g_malloc(1024);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5593 if (flags & PURPLE_MESSAGE_AUTO_RESP) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5594 g_snprintf(str, 1024, "%s %s", alias_escaped, AUTO_RESPONSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5595 tag_start_offset += 1
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5596 + strlen(AUTO_RESPONSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5597 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5598 g_snprintf(str, 1024, "%s:", alias_escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5599 tag_end_offset = 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5600 }
21840
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5601 if (flags & PURPLE_MESSAGE_NICK) {
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5602 GdkColor *col;
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5603 gtk_widget_style_get(GTK_WIDGET(gtkconv->imhtml), "highlight-name-color", &col, NULL);
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5604 if(col) {
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5605 g_snprintf(color, sizeof(color), "#%02X%02X%02X",
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5606 col->red >> 8, col->green >> 8, col->blue >> 8);
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5607 }
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5608 else {
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5609 strcpy(color, DEFAULT_HIGHLIGHT_COLOR);
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5610 }
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5611 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5612 else if (flags & PURPLE_MESSAGE_RECV) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5613 if (type == PURPLE_CONV_TYPE_CHAT) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5614 GdkColor *col = get_nick_color(gtkconv, name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5615
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5616 g_snprintf(color, sizeof(color), "#%02X%02X%02X",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5617 col->red >> 8, col->green >> 8, col->blue >> 8);
21840
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5618 } else {
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5619 GdkColor *col;
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5620 gtk_widget_style_get(GTK_WIDGET(gtkconv->imhtml), "receive-name-color", &col, NULL);
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5621 if(col) {
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5622 g_snprintf(color, sizeof(color), "#%02X%02X%02X",
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5623 col->red >> 8, col->green >> 8, col->blue >> 8);
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5624 }
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5625 else {
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5626 strcpy(color, DEFAULT_RECV_COLOR);
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5627 }
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5628 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5629 }
21840
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5630 else if (flags & PURPLE_MESSAGE_SEND) {
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5631 GdkColor *col;
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5632 gtk_widget_style_get(GTK_WIDGET(gtkconv->imhtml), "send-name-color", &col, NULL);
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5633 if(col) {
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5634 g_snprintf(color, sizeof(color), "#%02X%02X%02X",
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5635 col->red >> 8, col->green >> 8, col->blue >> 8);
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5636 }
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5637 else {
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5638 strcpy(color, DEFAULT_SEND_COLOR);
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5639 }
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5640 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5641 else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5642 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
5643 strcpy(color, "#000000");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5644 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5645 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5646 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5647
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5648 g_free(alias_escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5649
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5650 /* Are we in a chat where we can tell which users are buddies? */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5651 if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME) &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5652 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
5653
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5654 /* Bold buddies to make them stand out from non-buddies. */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5655 if (flags & PURPLE_MESSAGE_SEND ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5656 flags & PURPLE_MESSAGE_NICK ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5657 purple_find_buddy(account, name) != NULL) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5658 g_snprintf(buf2, BUF_LONG,
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5659 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\"><!--%s --></FONT>"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5660 "<B>%s</B></FONT> ",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5661 color, sml_attrib ? sml_attrib : "", mdate, str);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5662 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5663 g_snprintf(buf2, BUF_LONG,
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5664 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\"><!--%s --></FONT>"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5665 "%s</FONT> ",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5666 color, sml_attrib ? sml_attrib : "", mdate, str);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5667
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5668 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5669 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5670 /* Bold everyone's name to make the name stand out from the message. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5671 g_snprintf(buf2, BUF_LONG,
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5672 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\"><!--%s --></FONT>"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5673 "<B>%s</B></FONT> ",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5674 color, sml_attrib ? sml_attrib : "", mdate, str);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5675 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5676
18760
bf47d0401a96 Eliminate some unnecessary scrolling activity.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18671
diff changeset
5677 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all | GTK_IMHTML_NO_SCROLL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5678
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5679 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
5680 !(flags & PURPLE_MESSAGE_SEND)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5681
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5682 GtkTextIter start, end;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5683 GtkTextTag *buddytag = get_buddy_tag(conv, name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5684
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5685 gtk_text_buffer_get_end_iter(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5686 GTK_IMHTML(gtkconv->imhtml)->text_buffer,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5687 &end);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5688 gtk_text_iter_backward_chars(&end,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5689 tag_end_offset + 1);
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 gtk_text_buffer_get_end_iter(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5692 GTK_IMHTML(gtkconv->imhtml)->text_buffer,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5693 &start);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5694 gtk_text_iter_backward_chars(&start,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5695 strlen(str) + 1 - tag_start_offset);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5696
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5697 gtk_text_buffer_apply_tag(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5698 GTK_IMHTML(gtkconv->imhtml)->text_buffer,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5699 buddytag, &start, &end);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5700 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5701
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5702 g_free(str);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5703
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5704 if(gc){
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5705 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
5706 char *post = "</font>";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5707 int pre_len = strlen(pre);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5708 int post_len = strlen(post);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5709
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5710 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
5711
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5712 strcpy(with_font_tag, pre);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5713 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
5714 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
5715
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5716 length += pre_len + post_len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5717 g_free(pre);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5718 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5719 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5720 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
5721
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5722 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
5723 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
5724
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5725 g_free(with_font_tag);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5726 g_free(new_message);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5727 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5728
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5729 g_free(mdate);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5730 g_free(sml_attrib);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5731
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5732 /* Tab highlighting stuff */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5733 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
5734 {
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
5735 PidginUnseenState unseen = PIDGIN_UNSEEN_NONE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5736
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5737 if ((flags & PURPLE_MESSAGE_NICK) == PURPLE_MESSAGE_NICK)
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
5738 unseen = PIDGIN_UNSEEN_NICK;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5739 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
5740 ((flags & PURPLE_MESSAGE_ERROR) == PURPLE_MESSAGE_ERROR))
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
5741 unseen = PIDGIN_UNSEEN_EVENT;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5742 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
5743 unseen = PIDGIN_UNSEEN_NO_LOG;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5744 else
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
5745 unseen = PIDGIN_UNSEEN_TEXT;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5746
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5747 gtkconv_set_unseen(gtkconv, unseen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5748 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5749
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
5750 if (!(flags & PURPLE_MESSAGE_RECV))
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5751 {
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
5752 /* Restore the smiley-data */
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5753 GTK_IMHTML(gtkconv->imhtml)->default_smilies = tree;
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5754 GTK_IMHTML(gtkconv->imhtml)->smiley_data = smiley_data;
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
5755 }
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
5756
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5757 purple_signal_emit(pidgin_conversations_get_handle(),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5758 (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
5759 account, name, displaying, conv, flags);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5760 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
5761 update_typing_message(gtkconv, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5762 }
19559
11849a5c3951 Update the chat topic and userlist when reattaching the Pidgin UI.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19556
diff changeset
5763
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5764 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5765 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
5766 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5767 PurpleConvChat *chat;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5768 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5769 PidginChatPane *gtkchat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5770 GtkListStore *ls;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5771 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5772
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5773 char tmp[BUF_LONG];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5774 int num_users;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5775
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5776 chat = PURPLE_CONV_CHAT(conv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5777 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5778 gtkchat = gtkconv->u.chat;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5779
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
5780 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
5781
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5782 g_snprintf(tmp, sizeof(tmp),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5783 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
5784 num_users),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5785 num_users);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5786
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5787 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
5788
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5789 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
5790
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5791 #if GTK_CHECK_VERSION(2,6,0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5792 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
5793 GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5794 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5795
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5796 l = cbuddies;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5797 while (l != NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5798 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
5799 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5800 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5801
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5802 /* 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
5803 * 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
5804 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5805 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
5806 GTK_SORT_ASCENDING);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5807 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5808
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5809 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5810 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
5811 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
5812 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5813 PurpleConvChat *chat;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5814 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5815 PidginChatPane *gtkchat;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5816 PurpleConvChatBuddyFlags flags;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5817 PurpleConvChatBuddy *cbuddy;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5818 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5819 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5820 int f = 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5821
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5822 chat = PURPLE_CONV_CHAT(conv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5823 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5824 gtkchat = gtkconv->u.chat;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5825
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5826 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
5827
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5828 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
5829 return;
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 while (f != 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5832 char *val;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5833
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5834 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
5835
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5836 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
5837 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
5838 g_free(val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5839 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5840 }
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 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
5843
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5844 g_free(val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5845 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5846
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5847 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
5848 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5849
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5850 g_return_if_fail(new_alias != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5851
18305
ffd706ec0220 Set and use convchatbuddy->buddy.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18302
diff changeset
5852 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
5853
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5854 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
5855 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5856
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5857 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5858 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
5859 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5860 PurpleConvChat *chat;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5861 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5862 PidginChatPane *gtkchat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5863 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5864 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5865 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5866 char tmp[BUF_LONG];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5867 int num_users;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5868 gboolean f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5869
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5870 chat = PURPLE_CONV_CHAT(conv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5871 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5872 gtkchat = gtkconv->u.chat;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5873
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
5874 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
5875
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5876 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
5877 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
5878
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5879 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
5880 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5881
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5882 do {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5883 char *val;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5884
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5885 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
5886 CHAT_USERS_NAME_COLUMN, &val, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5887
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5888 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
5889 #if GTK_CHECK_VERSION(2,2,0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5890 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
5891 #else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5892 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
5893 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
5894 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5895 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5896 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5897 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
5898
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5899 g_free(val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5900 } while (f);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5901 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5902
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5903 g_snprintf(tmp, sizeof(tmp),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5904 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
5905 num_users), num_users);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5906
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5907 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
5908 }
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 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5911 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
5912 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5913 PurpleConvChat *chat;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5914 PurpleConvChatBuddyFlags flags;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5915 PurpleConvChatBuddy *cbuddy;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5916 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5917 PidginChatPane *gtkchat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5918 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5919 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5920 int f = 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5921 char *alias = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5922
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5923 chat = PURPLE_CONV_CHAT(conv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5924 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5925 gtkchat = gtkconv->u.chat;
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 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
5928
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5929 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
5930 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5931
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5932 while (f != 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5933 char *val;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5934
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5935 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
5936
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5937 if (!purple_utf8_strcasecmp(user, val)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5938 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_ALIAS_COLUMN, &alias, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5939 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
5940 g_free(val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5941 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5942 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5943
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5944 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
5945
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5946 g_free(val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5947 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5948
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5949 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
5950 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5951 g_free(alias);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5952 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5953 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5954
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5955 g_return_if_fail(alias != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5956
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5957 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
5958
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
5959 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
5960 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
5961 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
5962 g_free(alias);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5963 }
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 gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5966 pidgin_conv_has_focus(PurpleConversation *conv)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5967 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5968 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5969 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5970 gboolean has_focus;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5971
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5972 win = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5973
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5974 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
5975
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5976 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
5977 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5978
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5979 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5980 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5981
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
5982 static void pidgin_conv_custom_smiley_allocated(GdkPixbufLoader *loader, gpointer user_data)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5983 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5984 GtkIMHtmlSmiley *smiley;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5985
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5986 smiley = (GtkIMHtmlSmiley *)user_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5987 smiley->icon = gdk_pixbuf_loader_get_animation(loader);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5988
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5989 if (smiley->icon)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5990 g_object_ref(G_OBJECT(smiley->icon));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5991 #ifdef DEBUG_CUSTOM_SMILEY
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5992 purple_debug_info("custom-smiley", "pidgin_conv_custom_smiley_allocated(): got GdkPixbufAnimation %p for smiley '%s'\n", smiley->icon, smiley->smile);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5993 #endif
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
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
5996 static void pidgin_conv_custom_smiley_closed(GdkPixbufLoader *loader, gpointer user_data)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5997 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5998 GtkIMHtmlSmiley *smiley;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5999 GtkWidget *icon = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6000 GtkTextChildAnchor *anchor = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6001 GSList *current = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6002
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6003 smiley = (GtkIMHtmlSmiley *)user_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6004 if (!smiley->imhtml) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6005 #ifdef DEBUG_CUSTOM_SMILEY
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6006 purple_debug_error("custom-smiley", "pidgin_conv_custom_smiley_closed(): orphan smiley found: %p\n", smiley);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6007 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6008 g_object_unref(G_OBJECT(loader));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6009 smiley->loader = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6010 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6011 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6012
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6013 for (current = smiley->anchors; current; current = g_slist_next(current)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6014
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6015 icon = gtk_image_new_from_animation(smiley->icon);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6016
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6017 #ifdef DEBUG_CUSTOM_SMILEY
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6018 purple_debug_info("custom-smiley", "pidgin_conv_custom_smiley_closed(): got GtkImage %p from GtkPixbufAnimation %p for smiley '%s'\n",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6019 icon, smiley->icon, smiley->smile);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6020 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6021 if (icon) {
16964
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
6022 GList *wids;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6023 gtk_widget_show(icon);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6024
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6025 anchor = GTK_TEXT_CHILD_ANCHOR(current->data);
16964
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
6026 wids = gtk_text_child_anchor_get_widgets(anchor);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6027
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6028 g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_plaintext", purple_unescape_html(smiley->smile), g_free);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6029 g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_htmltext", g_strdup(smiley->smile), g_free);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6030
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
6031 if (smiley->imhtml) {
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
6032 if (wids) {
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
6033 GList *children = gtk_container_get_children(GTK_CONTAINER(wids->data));
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
6034 g_list_foreach(children, (GFunc)gtk_widget_destroy, NULL);
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
6035 g_list_free(children);
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
6036 gtk_container_add(GTK_CONTAINER(wids->data), icon);
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
6037 } else
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
6038 gtk_text_view_add_child_at_anchor(GTK_TEXT_VIEW(smiley->imhtml), icon, anchor);
ab45289d2c36 Allow saving custom smileys by right-clicking on them. And use the custom smileys only on the received messages, not for the system/etc. messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16939
diff changeset
6039 }
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
6040 g_list_free(wids);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6041 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6042
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6043 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6044
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6045 g_slist_free(smiley->anchors);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6046 smiley->anchors = NULL;
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 g_object_unref(G_OBJECT(loader));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6049 smiley->loader = NULL;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6052 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6053 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
6054 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6055 GtkIMHtmlSmiley *smiley;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6056 GdkPixbufLoader *loader;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6057
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6058 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
6059
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6060 if (smiley) {
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 if (!(smiley->flags & GTK_IMHTML_SMILEY_CUSTOM)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6063 return FALSE;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6066 /* Close the old GdkPixbufAnimation, then create a new one for
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6067 * the smiley we are about to receive */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6068 g_object_unref(G_OBJECT(smiley->icon));
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 /* XXX: Is it necessary to _unref the loader first? */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6071 smiley->loader = gdk_pixbuf_loader_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6072 smiley->icon = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6073
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6074 g_signal_connect(smiley->loader, "area_prepared", G_CALLBACK(pidgin_conv_custom_smiley_allocated), smiley);
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6075 g_signal_connect(smiley->loader, "closed", G_CALLBACK(pidgin_conv_custom_smiley_closed), smiley);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6076
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6077 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6078 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6079
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6080 loader = gdk_pixbuf_loader_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6081
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6082 /* this is wrong, this file ought not call g_new on GtkIMHtmlSmiley */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6083 /* Let gtk_imhtml have a gtk_imhtml_smiley_new function, and let
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6084 GtkIMHtmlSmiley by opaque */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6085 smiley = g_new0(GtkIMHtmlSmiley, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6086 smiley->file = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6087 smiley->smile = g_strdup(smile);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6088 smiley->loader = loader;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6089 smiley->flags = smiley->flags | GTK_IMHTML_SMILEY_CUSTOM;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6090
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6091 g_signal_connect(smiley->loader, "area_prepared", G_CALLBACK(pidgin_conv_custom_smiley_allocated), smiley);
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6092 g_signal_connect(smiley->loader, "closed", G_CALLBACK(pidgin_conv_custom_smiley_closed), smiley);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6093
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6094 gtk_imhtml_associate_smiley(imhtml, sml, smiley);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6095
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6099 static gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6100 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
6101 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6102 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6103 struct smiley_list *list;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6104 const char *sml = NULL, *conv_sml;
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 if (!conv || !smile || !*smile) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6107 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6108 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6109
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6110 /* 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
6111 if (pidgin_themes_smileys_disabled())
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6112 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6113
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6114 /* 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
6115 * 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
6116 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
6117 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6118
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6119 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
6120 if (!strcmp(list->sml, conv_sml)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6121 sml = list->sml;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6122 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6123 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6124 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6125
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6126 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
6127 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6128
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6129 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
6130 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
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 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6134 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6135
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6136 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6137 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
6138 const guchar *data, gsize size)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6139 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6140 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6141 GtkIMHtmlSmiley *smiley;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6142 GdkPixbufLoader *loader;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6143 const char *sml;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6144
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6145 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
6146 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6147 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
6148
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6149 if (!smiley)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6150 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6151
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6152 loader = smiley->loader;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6153 if (!loader)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6154 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6155
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6156 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
6157 }
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 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6160 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
6161 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6162 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6163 GtkIMHtmlSmiley *smiley;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6164 GdkPixbufLoader *loader;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6165 const char *sml;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6166
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6167 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6168 g_return_if_fail(smile != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6169
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6170 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
6171 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6172 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
6173
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6174 if (!smiley)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6175 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6176
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6177 loader = smiley->loader;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6178
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6179 if (!loader)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6180 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6181
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6182
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6183
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6184 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
6185
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6186 gdk_pixbuf_loader_close(loader, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6187
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6188 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6189
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6190 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6191 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
6192 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6193 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6194
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6195 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
6196 }
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 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6199 * 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
6200 * 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
6201 * account signs on or off.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6202 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6203 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6204 gray_stuff_out(PidginConversation *gtkconv)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6205 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6206 PidginWindow *win;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6207 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6208 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6209 PurplePluginProtocolInfo *prpl_info = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6210 GdkPixbuf *window_icon = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6211 GtkIMHtmlButtons buttons;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6212 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6213
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6214 win = pidgin_conv_get_window(gtkconv);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6215 gc = purple_conversation_get_gc(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6216 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6217
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6218 if (gc != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6219 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
6220
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6221 if (win->menu.send_to != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6222 update_send_to_selection(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6223
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6224 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6225 * 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
6226 * 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
6227 * 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
6228 * 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
6229 * 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
6230 * is sensitive or not.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6231 */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6232 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
6233 /* 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
6234
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6235 /* Deal with menu items */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6236 gtk_widget_show(win->menu.view_log);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6237 gtk_widget_show(win->menu.send_file);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6238 gtk_widget_show(win->menu.add_pounce);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6239 gtk_widget_show(win->menu.get_info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6240 gtk_widget_hide(win->menu.invite);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6241 gtk_widget_show(win->menu.alias);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6242 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
6243 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
6244 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
6245 } 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
6246 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
6247 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
6248 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6249
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6250 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
6251 gtk_widget_show(win->menu.add);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6252 gtk_widget_hide(win->menu.remove);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6253 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6254 gtk_widget_show(win->menu.remove);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6255 gtk_widget_hide(win->menu.add);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6256 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6257
17776
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
6258 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
6259 gtk_widget_show(win->menu.insert_image);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6260 } 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
6261 /* 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
6262
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6263 /* Deal with menu items */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6264 gtk_widget_show(win->menu.view_log);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6265 gtk_widget_hide(win->menu.send_file);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6266 gtk_widget_hide(win->menu.add_pounce);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6267 gtk_widget_hide(win->menu.get_info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6268 gtk_widget_show(win->menu.invite);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6269 gtk_widget_show(win->menu.alias);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6270 gtk_widget_hide(win->menu.block);
15555
883bf81c8d73 Hide the unblock menuitem for chats.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15465
diff changeset
6271 gtk_widget_hide(win->menu.unblock);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6272
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6273 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
6274 /* 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
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 /* 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
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 gtk_widget_show(win->menu.remove);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6281 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6282
17776
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_link);
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
6284 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
6285 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6286
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6287 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6288 * 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
6289 * and what features that account supports.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6290 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6291 if ((gc != NULL) &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6292 ((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
6293 !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
6294 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6295 /* Account is online */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6296 /* Deal with the toolbar */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6297 if (conv->features & PURPLE_CONNECTION_HTML)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6298 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6299 buttons = GTK_IMHTML_ALL; /* Everything on */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6300 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
6301 buttons &= ~GTK_IMHTML_BACKCOLOR;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6302 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
6303 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6304 buttons &= ~GTK_IMHTML_GROW;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6305 buttons &= ~GTK_IMHTML_SHRINK;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6306 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6307 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
6308 buttons &= ~GTK_IMHTML_LINKDESC;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6309 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6310 buttons = GTK_IMHTML_SMILEY | GTK_IMHTML_IMAGE;
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
18167
b8b475f31008 Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <stu@nosnilmot.com>
parents: 18121
diff changeset
6313 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
6314 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
6315
b8b475f31008 Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <stu@nosnilmot.com>
parents: 18121
diff changeset
6316 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
6317 buttons &= ~GTK_IMHTML_IMAGE;
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 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
6320 if (account != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6321 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
6322
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6323 /* Deal with menu items */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6324 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
6325 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
6326 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
6327 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
6328 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
6329 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
6330
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6331 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
6332 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6333 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
6334 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
6335 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
6336 (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
6337 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
6338 gtk_widget_set_sensitive(win->menu.alias,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6339 (account != NULL) &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6340 (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
6341 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6342 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
6343 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6344 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
6345 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
6346 gtk_widget_set_sensitive(win->menu.alias,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6347 (account != NULL) &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6348 (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
6349 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6350
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6351 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6352 /* Account is offline */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6353 /* 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
6354
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6355 /* Then deal with menu items */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6356 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
6357 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
6358 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
6359 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
6360 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
6361 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
6362 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
6363 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
6364 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
6365 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
6366 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6367
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6368 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6369 * Update the window's icon
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6370 */
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6371 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
6372 {
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
6373 GList *l = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6374 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
6375 (gtkconv->u.im->anim))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6376 {
20183
dd4c3d712835 applied changes from 9d5a2f820265e4631d68d0f12a2def66acf36e3d
Richard Laager <rlaager@wiktel.com>
parents: 20028
diff changeset
6377 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
6378 window_icon =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6379 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
6380
dd4c3d712835 applied changes from 9d5a2f820265e4631d68d0f12a2def66acf36e3d
Richard Laager <rlaager@wiktel.com>
parents: 20028
diff changeset
6381 if (buddy && !PURPLE_BUDDY_IS_ONLINE(buddy))
dd4c3d712835 applied changes from 9d5a2f820265e4631d68d0f12a2def66acf36e3d
Richard Laager <rlaager@wiktel.com>
parents: 20028
diff changeset
6382 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
6383
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6384 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
6385 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
6386 } 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
6387 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
6388 }
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
6389 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
6390 if (window_icon != NULL) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6391 g_object_unref(G_OBJECT(window_icon));
15749
74923b83e042 Fix a small leak
Sean Egan <seanegan@gmail.com>
parents: 15748
diff changeset
6392 g_list_free(l);
74923b83e042 Fix a small leak
Sean Egan <seanegan@gmail.com>
parents: 15748
diff changeset
6393 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6394 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6395 }
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 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6398 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
6399 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6400 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6401 PidginWindow *win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6402
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6403 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6404 if (!gtkconv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6405 return;
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6406 win = pidgin_conv_get_window(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6407 if (!win)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6408 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6409
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6410 if (fields & PIDGIN_CONV_SET_TITLE)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6411 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6412 purple_conversation_autoset_title(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6413 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6414
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6415 if (fields & PIDGIN_CONV_BUDDY_ICON)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6416 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6417 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
6418 pidgin_conv_update_buddy_icon(conv);
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6419 }
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6420
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6421 if (fields & PIDGIN_CONV_MENU)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6422 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6423 gray_stuff_out(PIDGIN_CONVERSATION(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6424 generate_send_to_items(win);
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
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6427 if (fields & PIDGIN_CONV_TAB_ICON)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6428 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6429 update_tab_icon(conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6430 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
6431 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6432
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6433 if ((fields & PIDGIN_CONV_TOPIC) &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6434 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
6435 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6436 const char *topic;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6437 PurpleConvChat *chat = PURPLE_CONV_CHAT(conv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6438 PidginChatPane *gtkchat = gtkconv->u.chat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6439
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6440 if (gtkchat->topic_text != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6441 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6442 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
6443
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6444 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
6445 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
6446 topic ? topic : "", NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6447 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6448 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6449
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6450 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
6451 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
6452
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6453 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
6454 (fields & PIDGIN_CONV_SET_TITLE) ||
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6455 (fields & PIDGIN_CONV_TOPIC))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6456 {
19291
c003aa584909 Remove truncation until we can do it smarter
Sean Egan <seanegan@gmail.com>
parents: 19290
diff changeset
6457 char *title;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6458 PurpleConvIm *im = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6459 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
6460 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
6461 PurplePresence *p = NULL;
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6462 char *markup = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6463 AtkObject *accessibility_obj;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6464 /* 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
6465 char *style;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6466
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6467 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
6468 im = PURPLE_CONV_IM(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6469
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6470 if ((account == NULL) ||
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6471 !purple_account_is_connected(account) ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6472 ((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
6473 && 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
6474 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
6475 else
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6476 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
6477
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6478 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
6479 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
6480 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
6481 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
6482 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
6483 } else {
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6484 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
6485 }
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6486 } 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
6487 const char *topic = gtkconv->u.chat->topic_text ? gtk_entry_get_text(GTK_ENTRY(gtkconv->u.chat->topic_text)) : NULL;
21710
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6488 char *esc = NULL;
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6489 #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
6490 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
6491 #else
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6492 /* 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
6493 * 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
6494 int len = 0;
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6495 char *c, *tmp = g_strdup(topic);
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6496 c = tmp;
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6497 while(*c && len < 72) {
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6498 c = g_utf8_next_char(c);
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6499 len++;
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6500 }
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6501 if (len == 72) {
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6502 *c = '\0';
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6503 c = g_strdup_printf("%s...", tmp);
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6504 g_free(tmp);
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6505 tmp = c;
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6506 }
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6507 esc = tmp ? g_markup_escape_text(tmp, -1) : NULL;
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6508 g_free(tmp);
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6509 #endif
18290
2e7a9f33cfd3 Handle NULL chat topics
Sean Egan <seanegan@gmail.com>
parents: 18289
diff changeset
6510 markup = g_strdup_printf("%s%s<span color='%s' size='smaller'>%s</span>",
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6511 purple_conversation_get_title(conv),
19234
aafa9b36344e Double-click infopane to alias or change topic. Also, show alias instead of screenname in infopane
Sean Egan <seanegan@gmail.com>
parents: 19231
diff changeset
6512 esc && *esc ? "\n" : "",
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6513 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
6514 esc ? esc : "");
c8f18378045c Properly escape the chat-topics in the infopane. Fixes #1903.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18876
diff changeset
6515 g_free(esc);
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6516 }
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
6517 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
6518 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
6519 /* 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
6520 gtk_widget_queue_draw(gtkconv->infopane);
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6521
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
6522 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
6523 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
6524
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6525 if (!GTK_WIDGET_REALIZED(gtkconv->tab_label))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6526 gtk_widget_realize(gtkconv->tab_label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6527
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6528 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
6529 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
6530 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
6531 atk_object_set_description(accessibility_obj, _("Typing"));
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6532 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
6533 } 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
6534 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
6535 atk_object_set_description(accessibility_obj, _("Stopped Typing"));
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6536 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
6537 } 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
6538 atk_object_set_description(accessibility_obj, _("Nick Said"));
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6539 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
6540 } 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
6541 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
6542 if (gtkconv->active_conv->type == PURPLE_CONV_TYPE_CHAT)
21704
a4b36b22ea94 New style.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21703
diff changeset
6543 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
6544 else
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6545 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
6546 } 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
6547 atk_object_set_description(accessibility_obj, _("New Event"));
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6548 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
6549 } 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
6550 style = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6551 }
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
6552
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6553 gtk_widget_set_name(gtkconv->tab_label, style);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6554 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
6555 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
6556
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
6557 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
6558 gtkconv->unseen_state == PIDGIN_UNSEEN_NICK ||
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6559 gtkconv->unseen_state == PIDGIN_UNSEEN_EVENT) {
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6560 PangoAttrList *list = pango_attr_list_new();
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6561 PangoAttribute *attr = pango_attr_weight_new(PANGO_WEIGHT_BOLD);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6562 attr->start_index = 0;
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6563 attr->end_index = -1;
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6564 pango_attr_list_insert(list, attr);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6565 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
6566 pango_attr_list_unref(list);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6567 } else
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6568 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
6569
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6570 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
6571 update_typing_icon(gtkconv);
22038
13d290879e0a shorted the 'typing then stopped' message
Sean Egan <seanegan@gmail.com>
parents: 22037
diff changeset
6572
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6573 gtk_label_set_text(GTK_LABEL(gtkconv->menu_label), title);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6574 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
6575 gtk_window_set_title(GTK_WINDOW(win->window), title);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6576
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6577 g_free(title);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6578 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6579 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6580
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6581 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6582 pidgin_conv_updated(PurpleConversation *conv, PurpleConvUpdateType type)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6583 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6584 PidginConvFields flags = 0;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6585
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6586 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6587
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6588 if (type == PURPLE_CONV_UPDATE_ACCOUNT)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6589 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6590 flags = PIDGIN_CONV_ALL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6591 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6592 else if (type == PURPLE_CONV_UPDATE_TYPING ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6593 type == PURPLE_CONV_UPDATE_UNSEEN ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6594 type == PURPLE_CONV_UPDATE_TITLE)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6595 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6596 flags = PIDGIN_CONV_COLORIZE_TITLE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6597 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6598 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
6599 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6600 flags = PIDGIN_CONV_TOPIC;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6601 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6602 else if (type == PURPLE_CONV_ACCOUNT_ONLINE ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6603 type == PURPLE_CONV_ACCOUNT_OFFLINE)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6604 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6605 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
6606 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6607 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
6608 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6609 flags = PIDGIN_CONV_TAB_ICON;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6610 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6611 else if (type == PURPLE_CONV_UPDATE_ADD ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6612 type == PURPLE_CONV_UPDATE_REMOVE ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6613 type == PURPLE_CONV_UPDATE_CHATLEFT)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6614 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6615 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
6616 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6617 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
6618 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6619 flags = PIDGIN_CONV_BUDDY_ICON;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6620 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6621 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
6622 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6623 flags = PIDGIN_CONV_MENU;
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6624 }
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6625
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6626 pidgin_conv_update_fields(conv, flags);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6627 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6628
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
6629 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
6630 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
6631 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
6632 {
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
6633 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
6634 return;
20953
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
6635 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
6636 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
6637
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
6638 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
6639 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
6640 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
6641 ((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
6642 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
6643 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
6644 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
6645 else
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
6646 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
6647
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
6648 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
6649 }
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
6650 }
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
6651
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6652 static PurpleConversationUiOps conversation_ui_ops =
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 pidgin_conv_new,
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6655 pidgin_conv_destroy, /* destroy_conversation */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6656 NULL, /* write_chat */
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6657 pidgin_conv_write_im, /* write_im */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6658 pidgin_conv_write_conv, /* write_conv */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6659 pidgin_conv_chat_add_users, /* chat_add_users */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6660 pidgin_conv_chat_rename_user, /* chat_rename_user */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6661 pidgin_conv_chat_remove_users, /* chat_remove_users */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6662 pidgin_conv_chat_update_user, /* chat_update_user */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6663 pidgin_conv_present_conversation, /* present */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6664 pidgin_conv_has_focus, /* has_focus */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6665 pidgin_conv_custom_smiley_add, /* custom_smiley_add */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6666 pidgin_conv_custom_smiley_write, /* custom_smiley_write */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6667 pidgin_conv_custom_smiley_close, /* custom_smiley_close */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6668 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
6669 NULL,
fbf111436896 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16604
diff changeset
6670 NULL,
fbf111436896 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16604
diff changeset
6671 NULL,
fbf111436896 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16604
diff changeset
6672 NULL
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6673 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6674
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6675 PurpleConversationUiOps *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6676 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
6677 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6678 return &conversation_ui_ops;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6679 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6680
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6681 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6682 * Public conversation utility functions
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6683 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6684 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6685 pidgin_conv_update_buddy_icon(PurpleConversation *conv)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6686 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6687 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6688 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6689
16381
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6690 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
6691
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6692 GdkPixbufLoader *loader;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6693 GdkPixbufAnimation *anim;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6694 GError *err = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6695
16381
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6696 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
6697 gconstpointer data = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6698 size_t len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6699
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6700 GdkPixbuf *buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6701
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6702 GtkWidget *event;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6703 GdkPixbuf *scale;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6704 int scale_width, scale_height;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6705
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6706 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6707 PurplePluginProtocolInfo *prpl_info = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6708
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6709 PurpleBuddyIcon *icon;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6710
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6711 g_return_if_fail(conv != NULL);
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
6712 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
6713 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
6714
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6715 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6716 win = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6717 if (conv != gtkconv->active_conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6718 return;
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 if (!gtkconv->u.im->show_icon)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6721 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6722
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6723 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6724 if(account && account->gc)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6725 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
6726
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6727 /* Remove the current icon stuff */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6728 if (gtkconv->u.im->icon_container != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6729 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
6730 gtkconv->u.im->icon_container = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6731
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6732 if (gtkconv->u.im->anim != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6733 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
6734
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6735 gtkconv->u.im->anim = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6736
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6737 if (gtkconv->u.im->icon_timer != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6738 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
6739
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6740 gtkconv->u.im->icon_timer = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6741
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6742 if (gtkconv->u.im->iter != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6743 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
6744
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6745 gtkconv->u.im->iter = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6746
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
6747 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
6748 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6749
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6750 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
6751 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6752
16381
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6753 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
6754 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
6755 {
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6756 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
6757 if (contact) {
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6758 custom_img = purple_buddy_icons_find_custom_icon(contact);
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6759 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
6760 /* 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
6761 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
6762 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
6763 }
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6764 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6765 }
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 if (data == NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6768 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
6769
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6770 if (icon == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6771 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6772
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6773 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
6774
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6775 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
6776 return;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6777 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6778
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6779 loader = gdk_pixbuf_loader_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6780 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
6781 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
6782
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
6783 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
6784
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6785 anim = gdk_pixbuf_loader_get_animation(loader);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6786 if (anim)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6787 g_object_ref(G_OBJECT(anim));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6788 g_object_unref(loader);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6789
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6790 if (!anim)
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 gtkconv->u.im->anim = anim;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6793
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6794 if (err) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6795 purple_debug(PURPLE_DEBUG_ERROR, "gtkconv",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6796 "Buddy icon error: %s\n", err->message);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6797 g_error_free(err);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6798 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6799
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6800 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
6801 GdkPixbuf *stat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6802 gtkconv->u.im->iter = NULL;
18213
270e87f5cde0 Round the other icons too
Sean Egan <seanegan@gmail.com>
parents: 18212
diff changeset
6803 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
6804 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
6805 } else {
18213
270e87f5cde0 Round the other icons too
Sean Egan <seanegan@gmail.com>
parents: 18212
diff changeset
6806 GdkPixbuf *stat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6807 gtkconv->u.im->iter =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6808 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
6809 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
6810 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
6811 if (gtkconv->u.im->animate)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6812 start_anim(NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6813 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6814
18214
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
6815 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
6816 scale_height = gdk_pixbuf_get_height(buf);
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
6817 if (scale_width == scale_height) {
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
6818 scale_width = scale_height = 32;
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
6819 } else if (scale_height > scale_width) {
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
6820 scale_width = 32 * scale_width / scale_height;
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
6821 scale_height = 32;
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
6822 } else {
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
6823 scale_height = 32 * scale_height / scale_width;
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
6824 scale_width = 32;
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
6825 }
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
6826 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
6827 GDK_INTERP_BILINEAR);
18213
270e87f5cde0 Round the other icons too
Sean Egan <seanegan@gmail.com>
parents: 18212
diff changeset
6828 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
6829 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
6830 pidgin_gdk_pixbuf_make_round(scale);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6831 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
6832
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6833 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
6834 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
6835 #if GTK_CHECK_VERSION(2,4,0)
18821
0765cf9331f6 warning fixes
Sean Egan <seanegan@gmail.com>
parents: 18820
diff changeset
6836 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
6837 #endif
18781
8b0663abb488 add tooltip to buddy icon in conversation too
Sean Egan <seanegan@gmail.com>
parents: 18779
diff changeset
6838 gtk_widget_add_events(event,
8b0663abb488 add tooltip to buddy icon in conversation too
Sean Egan <seanegan@gmail.com>
parents: 18779
diff changeset
6839 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
6840 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
6841 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
6842
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
6843 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
6844 gtk_widget_show(event);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6845
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6846 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
6847 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
6848 gtk_widget_show(gtkconv->u.im->icon);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6849
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6850 g_object_unref(G_OBJECT(scale));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6851
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
6852 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
6853 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
6854
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6855 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
6856
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6857 /* 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
6858 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
6859 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6860 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6861 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
6862 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6863 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6864
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6865 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6866 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
6867 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6868 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6869
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
6870 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6871 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6872
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6873 win = PIDGIN_CONVERSATION(conv)->win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6874
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6875 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
6876 gray_stuff_out(PIDGIN_CONVERSATION(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6877 }
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 int
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6880 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
6881 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6882 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
6883 GtkNotebook *notebook;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6884 GtkWidget *page, *tab;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6885 gint i, page_num = -1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6886 gint count;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6887 gboolean horiz;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6888
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6889 if (to_right)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6890 *to_right = FALSE;
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 notebook = GTK_NOTEBOOK(win->notebook);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6893
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6894 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
6895 x_rel = x - nb_x;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6896 y_rel = y - nb_y;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6897
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6898 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
6899 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
6900
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6901 #if GTK_CHECK_VERSION(2,2,0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6902 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
6903 #else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6904 /* 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
6905 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
6906 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6907
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6908 for (i = 0; i < count; i++) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6909
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6910 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
6911 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
6912
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6913 /* Make sure the tab is not hidden beyond an arrow */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6914 if (!GTK_WIDGET_DRAWABLE(tab))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6915 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6916
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6917 if (horiz) {
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
6918 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
6919 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
6920 page_num = i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6921
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6922 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
6923 *to_right = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6924
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6925 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6926 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6927 } else {
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
6928 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
6929 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
6930 page_num = i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6931
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6932 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
6933 *to_right = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6934
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6935 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6936 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6937 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6938 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6939
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6940 if (page_num == -1) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6941 /* Add after the last tab */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6942 page_num = count - 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6943 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6944
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6945 return page_num;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6946 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6947
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6948 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6949 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
6950 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6951 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
6952 GList *l;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6953 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6954 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6955
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6956 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
6957 conv = (PurpleConversation *)l->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6958
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
6959 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6960 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6961
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6962 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6963
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6964 if (value)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6965 gtk_widget_show(gtkconv->close);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6966 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6967 gtk_widget_hide(gtkconv->close);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6968 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6969 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6970
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6971 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6972 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
6973 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6974 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6975 #ifdef USE_GTKSPELL
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
6976 GList *cl;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6977 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6978 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6979 GtkSpell *spell;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6980
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6981 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
6982
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6983 conv = (PurpleConversation *)cl->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6984
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
6985 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6986 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6987
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6988 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6989
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6990 if (value)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6991 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
6992 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6993 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
6994 gtkspell_detach(spell);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6995 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6996 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6997 #endif
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 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7001 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
7002 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7003 {
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
7004 GList *gtkwins, *gtkconvs;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7005 GtkPositionType pos;
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
7006 PidginWindow *gtkwin;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7007
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7008 pos = GPOINTER_TO_INT(value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7009
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
7010 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
7011 gtkwin = gtkwins->data;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
7012 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
7013 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
7014 pidgin_conv_tab_pack(gtkwin, gtkconvs->data);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
7015 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7016 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7017 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7018
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7019 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7020 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
7021 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7022 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
7023 GList *l;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7024 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7025 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7026 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7027
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7028 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
7029 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7030 conv = (PurpleConversation *)l->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7031
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
7032 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7033 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7034
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7035 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7036 win = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7037
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7038 gtk_check_menu_item_set_active(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7039 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
7040 (gboolean)GPOINTER_TO_INT(value));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7041
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7042 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
7043 (gboolean)GPOINTER_TO_INT(value));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7044 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7045 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7046
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7047 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7048 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
7049 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7050 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
7051 GList *l;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7052 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7053 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7054 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7055
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7056 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
7057 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7058 conv = (PurpleConversation *)l->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7059
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
7060 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7061 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7062
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7063 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7064 win = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7065
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7066 gtk_check_menu_item_set_active(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7067 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
7068 (gboolean)GPOINTER_TO_INT(value));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7069
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7070 if ((gboolean)GPOINTER_TO_INT(value))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7071 gtk_widget_show(gtkconv->toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7072 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7073 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
7074
21665
baa25b613999 Clean up warnings
Sean Egan <seanegan@gmail.com>
parents: 21664
diff changeset
7075 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
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 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
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
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7088 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
7089 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7090
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7091 /* 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
7092 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
7093 conv = (PurpleConversation *)l->data;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7094 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
7095 if (gtkconv)
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
7096 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
7097 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7098
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7099 /* 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
7100 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
7101 win = l->data;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7102 conv = pidgin_conv_window_get_active_conversation(win);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7103 pidgin_conv_update_buddy_icon(conv);
15374
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_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
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;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7112
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7113 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
7114 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
7115 if (!PIDGIN_CONVERSATION(conv))
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
7116 continue;
18602
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7117 if (GPOINTER_TO_INT(value))
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7118 gtk_widget_show(PIDGIN_CONVERSATION(conv)->infopane_hbox);
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7119 else
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7120 gtk_widget_hide(PIDGIN_CONVERSATION(conv)->infopane_hbox);
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7121
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7122 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
7123 pidgin_conv_update_buddy_icon(conv);
18602
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7124 }
15374
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7127
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7128 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
7129 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
7130 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
7131 {
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
7132 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
7133 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
7134 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
7135 if (PIDGIN_CONVERSATION(conv))
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
7136 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
7137 }
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
7138 }
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
7139
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
7140 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7141 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
7142 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7143 {
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7144 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
7145 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7146
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7147 static void
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7148 account_status_changed_cb(PurpleAccount *account, PurpleStatus *oldstatus,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7149 PurpleStatus *newstatus)
15374
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 GList *l;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7152 PurpleConversation *conv = NULL;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7153 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7154
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7155 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
7156 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7157
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7158 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
7159 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7160
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7161 while ((l = hidden_convwin->gtkconvs) != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7162 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7163 gtkconv = l->data;
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 conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7166
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7167 while(l && !purple_status_is_available(
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7168 purple_account_get_active_status(
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7169 purple_conversation_get_account(conv))))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7170 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7171 if (!l)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7172 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7173
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7174 pidgin_conv_window_remove_gtkconv(hidden_convwin, gtkconv);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7175 pidgin_conv_placement_place(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7176
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7177 /* 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
7178 * 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
7179 purple_conversation_update(conv, PURPLE_CONV_UPDATE_UNSEEN);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7180 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7181 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7182
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7183 static void
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7184 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
7185 gconstpointer value, gpointer data)
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 GList *l;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7188 PurpleConversation *conv = NULL;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7189 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7190 gboolean when_away = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7191
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7192 if(!hidden_convwin)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7193 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7194
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7195 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
7196 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7197
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7198 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
7199 when_away = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7200
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
7201 for (l = hidden_convwin->gtkconvs; l; )
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7202 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7203 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
7204 l = l->next;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7205
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7206 conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7207
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
7208 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
7209 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
7210 (when_away && !purple_status_is_available(
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7211 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
7212 purple_conversation_get_account(conv)))))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7213 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7214
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7215 pidgin_conv_window_remove_gtkconv(hidden_convwin, gtkconv);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7216 pidgin_conv_placement_place(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7217 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7218 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7219
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 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7222 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
7223 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7224 {
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
7225 PidginConvPlacementFunc func;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7226
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7227 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
7228 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7229
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7230 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
7231
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7232 if (func == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7233 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7234
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7235 pidgin_conv_placement_set_current_func(func);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7236 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7237
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7238 static PidginConversation *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7239 get_gtkconv_with_contact(PurpleContact *contact)
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 PurpleBlistNode *node;
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 node = ((PurpleBlistNode*)contact)->child;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7244
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7245 for (; node; node = node->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7246 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7247 PurpleBuddy *buddy = (PurpleBuddy*)node;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7248 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7249 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
7250 if (conv)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7251 return PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7252 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7253 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7254 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7255
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7256 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7257 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
7258 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
7259 GList *iter;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7260
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7261 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
7262 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7263 PurpleConversation *conv = iter->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7264
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7265 /* 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
7266 * 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
7267 * 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
7268 * 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
7269 /* if (purple_conversation_get_account(conv) == account) */
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7270 pidgin_conv_update_fields(conv, PIDGIN_CONV_TAB_ICON |
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7271 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
7272
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7273 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
7274 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
7275 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
7276 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
7277 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
7278 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
7279 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
7280 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
7281 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
7282 } else {
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7283 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
7284 }
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7285 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
7286 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
7287 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
7288 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7289 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7290 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7291
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7292 static gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7293 update_buddy_status_timeout(PurpleBuddy *buddy)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7294 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7295 /* 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
7296 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7297
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7298 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
7299 if (conv)
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7300 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
7301
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7302 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7303 }
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 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7306 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
7307 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7308 PidginConversation *gtkconv;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7309 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7310
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7311 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
7312 if (gtkconv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7313 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7314 conv = gtkconv->active_conv;
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7315 pidgin_conv_update_fields(conv, PIDGIN_CONV_TAB_ICON | PIDGIN_CONV_COLORIZE_TITLE);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7316 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
7317 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
7318 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7319
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7320 /* 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
7321 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
7322 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7323
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7324 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7325 update_buddy_privacy_changed(PurpleBuddy *buddy)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7326 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7327 PidginConversation *gtkconv;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7328 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7329
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7330 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
7331 if (gtkconv) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7332 conv = gtkconv->active_conv;
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7333 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
7334 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7335 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7336
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7337 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7338 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
7339 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7340 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7341
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7342 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
7343 if (conv)
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7344 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
7345 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7346
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7347 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7348 update_buddy_icon(PurpleBuddy *buddy)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7349 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7350 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7351
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7352 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
7353 if (conv)
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7354 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
7355 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7356
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7357 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7358 update_buddy_sign(PurpleBuddy *buddy, const char *which)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7359 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7360 PurplePresence *presence;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7361 PurpleStatus *on, *off;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7362
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7363 presence = purple_buddy_get_presence(buddy);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7364 if (!presence)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7365 return;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7366 off = purple_presence_get_status(presence, "offline");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7367 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
7368
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7369 if (*(which+1) == 'f')
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7370 update_buddy_status_changed(buddy, on, off);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7371 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7372 update_buddy_status_changed(buddy, off, on);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7375 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7376 update_conversation_switched(PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7377 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7378 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
7379 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
7380 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7381
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7382 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7383 update_buddy_typing(PurpleAccount *account, const char *who)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7384 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7385 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7386 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7387
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7388 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
7389 if (!conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7390 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7391
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7392 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7393 if (gtkconv && gtkconv->active_conv == conv)
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7394 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
7395 }
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 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7398 update_chat(PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7399 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7400 pidgin_conv_update_fields(conv, PIDGIN_CONV_TOPIC |
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7401 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
7402 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7403
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7404 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7405 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
7406 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7407 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
7408 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7409
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7410 /* Message history stuff */
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7411
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7412 /* 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
7413 static int
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7414 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
7415 {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7416 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
7417 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
7418 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7419
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7420 /* 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
7421 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
7422 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
7423 {
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7424 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
7425 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
7426 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
7427 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
7428 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
7429
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
7430 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
7431 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
7432 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
7433 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
7434 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
7435 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
7436 }
21263
1812b8ccfd7a Show alias in restored conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21244
diff changeset
7437 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
7438 if (im) {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7439 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
7440 } else {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7441 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
7442 }
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
7443 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
7444 }
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7445 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
7446 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
7447 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
7448
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7449 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
7450 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
7451 if (im) {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7452 /* 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
7453 GList *msgs = NULL;
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7454 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
7455 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
7456 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
7457 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
7458 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
7459 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
7460 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
7461 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
7462 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7463 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7464 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
7465 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
7466 PurpleConvMessage *msg = msgs->data;
21263
1812b8ccfd7a Show alias in restored conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21244
diff changeset
7467 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
7468 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7469 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
7470 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
7471 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7472
20552
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7473 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
7474 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
7475 "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
7476 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
7477 }
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7478
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7479 static void
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7480 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
7481 {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7482 int timer;
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7483 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
7484 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
7485 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
7486 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
7487 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
7488 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
7489 if (timer) {
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7490 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
7491 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
7492 }
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7493 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7494
19417
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7495 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
7496 {
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7497 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
7498 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
7499
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7500 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
7501 /* This is pretty much always the case now. */
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7502 gtkconv = PIDGIN_CONVERSATION(conv);
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7503 if (gtkconv->win != hidden_convwin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7504 return FALSE;
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7505 pidgin_conv_window_remove_gtkconv(hidden_convwin, gtkconv);
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7506 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
7507 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
7508 "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
7509 list = gtkconv->convs;
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
7510 while (list) {
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
7511 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
7512 list = list->next;
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
7513 }
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7514 return TRUE;
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7515 }
19417
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7516
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7517 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
7518 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
7519
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7520 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
7521 if (list) {
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7522 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
7523 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
7524 {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7525 GList *convs;
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7526 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
7527 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
7528 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
7529 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
7530 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
7531 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
7532 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7533 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
7534 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
7535 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
7536 break;
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7537 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7538 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
7539 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
7540 break;
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7541 default:
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7542 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
7543 }
20051
d9a6d6ac2537 We can do this without forcing a minor bump.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20050
diff changeset
7544 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
7545 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
7546 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
7547 } else {
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7548 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
7549 "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
7550 }
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7551
19559
11849a5c3951 Update the chat topic and userlist when reattaching the Pidgin UI.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19556
diff changeset
7552 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
7553 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
7554 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
7555 }
19417
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7556
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7557 return TRUE;
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
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7560 void *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7561 pidgin_conversations_get_handle(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7562 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7563 static int handle;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7564
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7565 return &handle;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7566 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7567
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7568 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7569 pidgin_conversations_init(void)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7570 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7571 void *handle = pidgin_conversations_get_handle();
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7572 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
7573
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7574 /* 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
7575 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
7576 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
7577 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
7578 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
7579 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
7580 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
7581 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
7582 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/show_incoming_formatting", TRUE);
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7583
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7584 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
7585 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
7586
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7587 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
7588 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
7589 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
7590 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
7591 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
7592 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
7593 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
7594 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
7595 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
7596
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
7597 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
7598 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
7599
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7600 /* 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
7601 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
7602 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
7603 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
7604 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
7605 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
7606 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
7607 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
7608
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7609 /* 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
7610 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
7611 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
7612 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
7613 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
7614 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
7615
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7616 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
7617
19229
f1fb41d31c70 Set a larger default conversation size. Previously we were using
Mark Doliner <mark@kingant.net>
parents: 19223
diff changeset
7618 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
7619 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
7620
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7621 purple_prefs_add_string(PIDGIN_PREFS_ROOT "/conversations/im/hide_new", "never");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7622
18779
f6656fd1d2d5 Initialize the win32 minimize new conv. windows pref to avoid warnings.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18760
diff changeset
7623 #ifdef _WIN32
f6656fd1d2d5 Initialize the win32 minimize new conv. windows pref to avoid warnings.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18760
diff changeset
7624 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
7625 #endif
f6656fd1d2d5 Initialize the win32 minimize new conv. windows pref to avoid warnings.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18760
diff changeset
7626
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7627 /* 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
7628 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
7629 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
7630 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
7631 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
7632 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
7633 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
7634 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
7635 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
7636 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
7637 tab_side_pref_cb, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7638
16062
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_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
7640 conv_placement_usetabs_cb, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7641
16062
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_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
7643 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
7644 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
7645
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7646 /* 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
7647 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
7648 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
7649 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
7650 show_buddy_icons_pref_cb, NULL);
19474
74befdcd0454 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@gmail.com>
parents: 19468
diff changeset
7651 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/im/show_protocol_icons",
74befdcd0454 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@gmail.com>
parents: 19468
diff changeset
7652 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
7653 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
7654 hide_new_pref_cb, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7655
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7656
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7657
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7658 /**********************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7659 * Register signals
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7660 **********************************************************************/
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7661 purple_signal_register(handle, "conversation-dragging",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7662 purple_marshal_VOID__POINTER_POINTER, NULL, 2,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7663 purple_value_new(PURPLE_TYPE_BOXED,
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7664 "PidginWindow *"),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7665 purple_value_new(PURPLE_TYPE_BOXED,
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7666 "PidginWindow *"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7667
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7668 purple_signal_register(handle, "conversation-timestamp",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7669 #if SIZEOF_TIME_T == 4
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7670 purple_marshal_POINTER__POINTER_INT_BOOLEAN,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7671 #elif SIZEOF_TIME_T == 8
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7672 purple_marshal_POINTER__POINTER_INT64_BOOLEAN,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7673 #else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7674 #error Unkown size of time_t
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7675 #endif
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7676 purple_value_new(PURPLE_TYPE_STRING), 3,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7677 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7678 PURPLE_SUBTYPE_CONVERSATION),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7679 #if SIZEOF_TIME_T == 4
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7680 purple_value_new(PURPLE_TYPE_INT),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7681 #elif SIZEOF_TIME_T == 8
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7682 purple_value_new(PURPLE_TYPE_INT64),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7683 #else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7684 # error Unknown size of time_t
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7685 #endif
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7686 purple_value_new(PURPLE_TYPE_BOOLEAN));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7687
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7688 purple_signal_register(handle, "displaying-im-msg",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7689 purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7690 purple_value_new(PURPLE_TYPE_BOOLEAN), 5,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7691 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7692 PURPLE_SUBTYPE_ACCOUNT),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7693 purple_value_new(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7694 purple_value_new_outgoing(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7695 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7696 PURPLE_SUBTYPE_CONVERSATION),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7697 purple_value_new(PURPLE_TYPE_INT));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7698
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7699 purple_signal_register(handle, "displayed-im-msg",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7700 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
7701 NULL, 5,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7702 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7703 PURPLE_SUBTYPE_ACCOUNT),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7704 purple_value_new(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7705 purple_value_new(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7706 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7707 PURPLE_SUBTYPE_CONVERSATION),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7708 purple_value_new(PURPLE_TYPE_INT));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7709
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7710 purple_signal_register(handle, "displaying-chat-msg",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7711 purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7712 purple_value_new(PURPLE_TYPE_BOOLEAN), 5,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7713 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7714 PURPLE_SUBTYPE_ACCOUNT),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7715 purple_value_new(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7716 purple_value_new_outgoing(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7717 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7718 PURPLE_SUBTYPE_CONVERSATION),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7719 purple_value_new(PURPLE_TYPE_INT));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7720
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7721 purple_signal_register(handle, "displayed-chat-msg",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7722 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
7723 NULL, 5,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7724 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7725 PURPLE_SUBTYPE_ACCOUNT),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7726 purple_value_new(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7727 purple_value_new(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7728 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7729 PURPLE_SUBTYPE_CONVERSATION),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7730 purple_value_new(PURPLE_TYPE_INT));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7731
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7732 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
7733 purple_marshal_VOID__POINTER, NULL, 1,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7734 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7735 PURPLE_SUBTYPE_CONVERSATION));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7736
19556
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7737 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
7738 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
7739 purple_value_new(PURPLE_TYPE_BOXED,
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7740 "PidginConversation *"));
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7741
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7742 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
7743 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
7744 purple_value_new(PURPLE_TYPE_BOXED,
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7745 "PidginConversation *"));
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7746
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7747 /**********************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7748 * Register commands
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7749 **********************************************************************/
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7750 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
7751 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
7752 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
7753 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
7754 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
7755 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
7756 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
7757 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
7758 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
7759 purple_cmd_register("clear", "", PURPLE_CMD_P_DEFAULT,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7760 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
7761 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
7762 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
7763 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
7764 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
7765 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
7766 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
7767 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
7768
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7769 /**********************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7770 * UI operations
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7771 **********************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7772
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7773 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
7774 G_CALLBACK(account_signed_off_cb),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7775 GINT_TO_POINTER(PURPLE_CONV_ACCOUNT_ONLINE));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7776 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
7777 G_CALLBACK(account_signed_off_cb),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7778 GINT_TO_POINTER(PURPLE_CONV_ACCOUNT_OFFLINE));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7779
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7780 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
7781 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
7782
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7783 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
7784
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7785 hidden_convwin = pidgin_conv_window_new();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7786 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
7787
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7788 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
7789 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
7790
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7791 /* Callbacks to update a conversation */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7792 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
7793 G_CALLBACK(buddy_update_cb), NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7794 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
7795 G_CALLBACK(buddy_update_cb), NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7796 purple_signal_connect(blist_handle, "buddy-signed-on",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7797 handle, PURPLE_CALLBACK(update_buddy_sign), "on");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7798 purple_signal_connect(blist_handle, "buddy-signed-off",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7799 handle, PURPLE_CALLBACK(update_buddy_sign), "off");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7800 purple_signal_connect(blist_handle, "buddy-status-changed",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7801 handle, PURPLE_CALLBACK(update_buddy_status_changed), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7802 purple_signal_connect(blist_handle, "buddy-privacy-changed",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7803 handle, PURPLE_CALLBACK(update_buddy_privacy_changed), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7804 purple_signal_connect(blist_handle, "buddy-idle-changed",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7805 handle, PURPLE_CALLBACK(update_buddy_idle_changed), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7806 purple_signal_connect(blist_handle, "buddy-icon-changed",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7807 handle, PURPLE_CALLBACK(update_buddy_icon), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7808 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
7809 handle, PURPLE_CALLBACK(update_buddy_typing), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7810 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
7811 handle, PURPLE_CALLBACK(update_buddy_typing), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7812 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
7813 handle, PURPLE_CALLBACK(update_conversation_switched), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7814 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
7815 PURPLE_CALLBACK(update_chat), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7816 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
7817 PURPLE_CALLBACK(update_chat), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7818 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
7819 PURPLE_CALLBACK(update_chat_topic), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7820 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
7821 PURPLE_CALLBACK(pidgin_conv_updated), NULL,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7822 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
7823 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
7824 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
7825 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
7826 PURPLE_CALLBACK(wrote_msg_update_unseen_cb), NULL);
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7827
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7828 {
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7829 /* Set default tab colors */
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7830 GString *str = g_string_new(NULL);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7831 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
7832 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
7833 struct {
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7834 const char *stylename;
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7835 const char *labelname;
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7836 const char *color;
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7837 } styles[] = {
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7838 {"pidgin_tab_label_typing_default", "tab-label-typing", "#4e9a06"},
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7839 {"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
7840 {"pidgin_tab_label_attention_default", "tab-label-attention", "#006aff"},
21704
a4b36b22ea94 New style.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21703
diff changeset
7841 {"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
7842 {"pidgin_tab_label_event_default", "tab-label-event", "#888a85"},
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7843 {NULL, NULL, NULL}
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7844 };
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7845 int iter;
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7846 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
7847 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
7848 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
7849 (parent && now && parent->rc_style == now->rc_style)) {
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7850 g_string_append_printf(str, "style \"%s\" {\n"
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7851 "fg[ACTIVE] = \"%s\"\n"
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7852 "}\n"
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7853 "widget \"*%s\" style \"%s\"\n",
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7854 styles[iter].stylename,
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7855 styles[iter].color,
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7856 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
7857 }
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7858 }
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7859 gtk_rc_parse_string(str->str);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7860 g_string_free(str, TRUE);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7861 #if GTK_CHECK_VERSION(2,4,0)
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7862 gtk_rc_reset_styles(settings);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7863 #endif
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7864 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7865 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7866
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7867 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7868 pidgin_conversations_uninit(void)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7869 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7870 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
7871 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
7872 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
7873 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7874
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7875
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7876
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7877
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7878
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7879
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7880
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7881
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7882
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7883
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7884
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7885
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7886
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7887
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7888
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7889
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7890 /* 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
7891 * 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
7892
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7893 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7894 * @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
7895 * @ingroup pidgin
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7896 *
15871
66dff3dfdea6 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
7897 * pidgin
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7898 *
15871
66dff3dfdea6 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
7899 * 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
7900 * 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
7901 * source distribution.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7902 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7903 * 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
7904 * 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
7905 * 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
7906 * (at your option) any later version.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7907 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7908 * 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
7909 * 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
7910 * 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
7911 * GNU General Public License for more details.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7912 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7913 * 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
7914 * 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
7915 * 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
7916 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7917 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7918 #include "internal.h"
15514
535f002e7b0f More pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15509
diff changeset
7919 #include "pidgin.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7920
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7921
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7922 #include <gdk/gdkkeysyms.h>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7923
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7924 #include "account.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7925 #include "cmds.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7926 #include "debug.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7927 #include "imgstore.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7928 #include "log.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7929 #include "notify.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7930 #include "prpl.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7931 #include "request.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7932 #include "util.h"
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 #include "gtkdnd-hints.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7935 #include "gtkblist.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7936 #include "gtkconv.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7937 #include "gtkdialogs.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7938 #include "gtkmenutray.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7939 #include "gtkpounce.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7940 #include "gtkprefs.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7941 #include "gtkprivacy.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7942 #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
7943 #include "pidginstock.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7944 #include "gtkimhtml.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7945 #include "gtkimhtmltoolbar.h"
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 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7948 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
7949 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7950 gtk_widget_destroy(warn_close_dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7951 warn_close_dialog = NULL;
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 if (resp == GTK_RESPONSE_OK)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7954 pidgin_conv_window_destroy(win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7955 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7956
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7957 static void
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7958 build_warn_close_dialog(PidginWindow *gtkwin)
15374
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 GtkWidget *label;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7961 GtkWidget *vbox, *hbox;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7962 GtkWidget *img;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7963
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7964 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
7965
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7966
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7967 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
7968 _("Confirm close"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7969 GTK_WINDOW(gtkwin->window), GTK_DIALOG_MODAL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7970 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
7971 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
7972
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7973 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
7974 GTK_RESPONSE_OK);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7975
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7976 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
7977 6);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7978 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
7979 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
7980 FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7981
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7982 /* Setup the outside spacing. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7983 vbox = GTK_DIALOG(warn_close_dialog)->vbox;
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 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
7986 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
7987
15436
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15435
diff changeset
7988 img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_WARNING,
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15435
diff changeset
7989 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
7990 /* 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
7991 hbox = gtk_hbox_new(FALSE, 12);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7992 gtk_container_add(GTK_CONTAINER(vbox), hbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7993 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
7994 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
7995
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7996 /* Setup the right vbox. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7997 vbox = gtk_vbox_new(FALSE, 12);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7998 gtk_container_add(GTK_CONTAINER(hbox), vbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7999
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8000 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
8001 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
8002 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
8003 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
8004 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
8005
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8006 /* Connect the signals. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8007 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
8008 G_CALLBACK(do_close), gtkwin);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8009
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8010 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8011
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8012 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8013 * Callbacks
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8014 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8015
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8016 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8017 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
8018 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8019 PidginWindow *win = d;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8020 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8021
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8022 /* 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
8023 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
8024 l != NULL; l = l->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8025 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8026 PidginConversation *gtkconv = l->data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8027 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
8028 gtkconv->unseen_state >= PIDGIN_UNSEEN_TEXT)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8029 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8030 build_warn_close_dialog(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8031 gtk_widget_show_all(warn_close_dialog);
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 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8034 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8035 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8036
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8037 pidgin_conv_window_destroy(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8038
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8039 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8040 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8041
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8042 static void
20953
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8043 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
8044 {
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8045 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
8046 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
8047
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8048 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
8049 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
8050
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8051 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
8052 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
8053
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8054 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
8055 {
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8056 unseen_count = 0;
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8057 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
8058 }
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8059 else
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8060 {
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8061 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
8062 unseen_count++;
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8063
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8064 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
8065 unseen_state = state;
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8066 }
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8067
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8068 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
8069 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
8070
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8071 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
8072 }
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8073
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8074 static void
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
8075 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
8076 {
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
8077 if (state == PIDGIN_UNSEEN_NONE)
15374
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 gtkconv->unseen_count = 0;
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
8080 gtkconv->unseen_state = PIDGIN_UNSEEN_NONE;
15374
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 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8083 {
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
8084 if (state >= PIDGIN_UNSEEN_TEXT)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8085 gtkconv->unseen_count++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8086
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8087 if (state > gtkconv->unseen_state)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8088 gtkconv->unseen_state = state;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8089 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8090
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8091 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
8092 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8093
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8094 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8095 * 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
8096 * 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
8097 * messages.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8098 */
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
8099 static gboolean
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8100 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
8101 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8102 PidginWindow *win = d;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8103 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
8104
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
8105 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
8106 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
8107
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8108 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8109 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8110
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8111 #if !GTK_CHECK_VERSION(2,6,0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8112 /* Courtesy of Galeon! */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8113 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8114 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
8115 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8116 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
8117 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
8118 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8119 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8120
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8121 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8122 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
8123 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8124 static GdkCursor *cursor = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8125
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8126 gtkwin->in_drag = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8127
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8128 if (gtkwin->drag_leave_signal) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8129 g_signal_handler_disconnect(G_OBJECT(widget),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8130 gtkwin->drag_leave_signal);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8131 gtkwin->drag_leave_signal = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8132 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8133
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8134 if (cursor == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8135 cursor = gdk_cursor_new(GDK_FLEUR);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8136
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8137 /* Grab the pointer */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8138 gtk_grab_add(gtkwin->notebook);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8139 #ifndef _WIN32
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8140 /* 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
8141 always be true after a button press. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8142 if (!gdk_pointer_is_grabbed())
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8143 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8144 gdk_pointer_grab(gtkwin->notebook->window, FALSE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8145 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
8146 NULL, cursor, GDK_CURRENT_TIME);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8147 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8148
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8149 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8150 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
8151 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8152
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 * 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
8155 * drag to be initiated.
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 if (win->in_predrag) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8158 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
8159 e->x_root >= win->drag_max_x ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8160 e->y_root < win->drag_min_y ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8161 e->y_root >= win->drag_max_y) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8162
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8163 win->in_predrag = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8164 notebook_init_grab(win, widget);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8165 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8166 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8167 else { /* Otherwise, draw the arrows. */
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8168 PidginWindow *dest_win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8169 GtkNotebook *dest_notebook;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8170 GtkWidget *tab;
17112
bee4ea11e299 Fix the tab-dragging arrows in conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17111
diff changeset
8171 gint page_num;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8172 gboolean horiz_tabs = FALSE;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8173 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8174 gboolean to_right = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8175
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8176 /* 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
8177 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
8178
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8179 if (dest_win == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8180 dnd_hints_hide_all();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8181
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8182 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8183 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8184
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8185 dest_notebook = GTK_NOTEBOOK(dest_win->notebook);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8186
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8187 page_num = pidgin_conv_get_tab_at_xy(dest_win,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8188 e->x_root, e->y_root, &to_right);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8189 to_right = to_right && (win != dest_win);
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 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
8192 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
8193 horiz_tabs = TRUE;
bee4ea11e299 Fix the tab-dragging arrows in conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17111
diff changeset
8194 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8195
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8196 gtkconv = pidgin_conv_window_get_gtkconv_at_index(dest_win, page_num);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8197 tab = gtkconv->tabby;
19235
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8198 if (gtk_notebook_get_show_tabs(dest_notebook) == FALSE) {
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8199 dnd_hints_show_relative(HINT_ARROW_DOWN, gtkconv->infopane, HINT_POSITION_CENTER, HINT_POSITION_TOP);
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8200 dnd_hints_show_relative(HINT_ARROW_UP, gtkconv->infopane, HINT_POSITION_CENTER, HINT_POSITION_BOTTOM);
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8201 } else if (horiz_tabs) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8202 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
8203 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
8204 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
8205 } else {
bee4ea11e299 Fix the tab-dragging arrows in conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17111
diff changeset
8206 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
8207 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
8208 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8209 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8210 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
8211 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
8212 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
8213 } else {
bee4ea11e299 Fix the tab-dragging arrows in conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17111
diff changeset
8214 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
8215 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
8216 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8217 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8218 }
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 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8221 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8222
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8223 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8224 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
8225 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8226 if (win->in_drag)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8227 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8228
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8229 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
8230 e->x_root >= win->drag_max_x ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8231 e->y_root < win->drag_min_y ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8232 e->y_root >= win->drag_max_y) {
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 win->in_predrag = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8235 notebook_init_grab(win, widget);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8236 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8237
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8238 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8239 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8240
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 * THANK YOU GALEON!
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8243 */
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
8244
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
8245 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
8246 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
8247 {
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
8248 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
8249 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
8250 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
8251 }
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
8252
18523
0a8f9829640f Show the 'send to' menu on right click on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18465
diff changeset
8253 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
8254 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
8255
19235
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8256 if (e->button == 1) {
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8257 int nb_x, nb_y;
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8258
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8259 if (gtkconv->win->in_drag)
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8260 return TRUE;
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8261
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8262 gtkconv->win->in_predrag = TRUE;
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8263 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
8264
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8265 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
8266
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8267 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
8268 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
8269 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
8270 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
8271
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8272 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
8273 G_CALLBACK(notebook_motion_cb), gtkconv->win);
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8274 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
8275 G_CALLBACK(notebook_leave_cb), gtkconv->win);
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8276 return FALSE;
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8277 }
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8278
18523
0a8f9829640f Show the 'send to' menu on right click on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18465
diff changeset
8279 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
8280 /* 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
8281 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
8282 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
8283 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
8284
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
8285 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
8286 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
8287 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
8288 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
8289 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
8290 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
8291 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
8292 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
8293 } 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
8294 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
8295 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
8296 }
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
8297
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
8298 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
8299 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
8300 return TRUE;
18671
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
8301 }
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
8302 return FALSE;
18671
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
8303 }
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
8304
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8305 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8306 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
8307 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8308 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
8309 int tab_clicked;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8310 GtkWidget *page;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8311 GtkWidget *tab;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8312
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
8313 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
8314 PidginConversation *gtkconv;
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8315 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
8316
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8317 if (tab_clicked == -1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8318 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8319
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8320 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
8321 close_conv_cb(NULL, NULL, gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8322 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8323 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8324
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8325
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8326 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
8327 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8328
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8329
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8330 if (win->in_drag) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8331 purple_debug(PURPLE_DEBUG_WARNING, "gtkconv",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8332 "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
8333 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8334 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8335
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8336 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8337 * 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
8338 * mess things up.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8339 */
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8340 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
8341
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8342 if (tab_clicked == -1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8343 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8344
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8345 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8346 * 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
8347 * the position of the notebook.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8348 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8349 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
8350
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8351 x_rel = e->x_root - nb_x;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8352 y_rel = e->y_root - nb_y;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8353
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8354 /* Reset the min/max x/y */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8355 win->drag_min_x = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8356 win->drag_min_y = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8357 win->drag_max_x = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8358 win->drag_max_y = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8359
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8360 /* Find out which tab was dragged. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8361 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
8362 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
8363
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8364 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
8365 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
8366 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
8367 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
8368
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8369 /* 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
8370 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
8371 e->x_root >= win->drag_max_x ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8372 e->y_root < win->drag_min_y ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8373 e->y_root >= win->drag_max_y) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8375 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8376 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8377
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8378 win->in_predrag = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8379 win->drag_tab = tab_clicked;
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 /* Connect the new motion signals. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8382 win->drag_motion_signal =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8383 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
8384 G_CALLBACK(notebook_motion_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8385
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8386 win->drag_leave_signal =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8387 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
8388 G_CALLBACK(notebook_leave_cb), win);
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 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8391 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8392
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8393 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8394 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
8395 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8396 PidginWindow *dest_win;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8397 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8398 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8399 gint dest_page_num = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8400 gboolean new_window = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8401 gboolean to_right = FALSE;
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 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8404 * 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
8405 * 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
8406 * close button.
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 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
8409 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8410
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8411 if (gdk_pointer_is_grabbed()) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8412 gdk_pointer_ungrab(GDK_CURRENT_TIME);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8413 gtk_grab_remove(widget);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8416 if (!win->in_predrag && !win->in_drag)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8417 return FALSE;
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 /* Disconnect the motion signal. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8420 if (win->drag_motion_signal) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8421 g_signal_handler_disconnect(G_OBJECT(widget),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8422 win->drag_motion_signal);
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 win->drag_motion_signal = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8425 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8426
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8427 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8428 * 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
8429 * signal.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8430 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8431 if (win->in_predrag) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8432 win->in_predrag = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8433
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8434 if (win->drag_leave_signal) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8435 g_signal_handler_disconnect(G_OBJECT(widget),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8436 win->drag_leave_signal);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8437
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8438 win->drag_leave_signal = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8439 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8440 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8441
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8442 /* If we're not in drag... */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8443 /* We're perfectly normal people! */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8444 if (!win->in_drag)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8445 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8446
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8447 win->in_drag = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8448
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8449 dnd_hints_hide_all();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8450
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8451 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
8452
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8453 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
8454
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8455 if (dest_win == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8456 /* 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
8457 * 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
8458 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
8459 /* 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
8460 dest_win = pidgin_conv_window_new();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8461 new_window = TRUE;
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 }
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 if (dest_win == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8466 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8467
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8468 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
8469 "conversation-dragging", win, dest_win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8470
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8471 /* Get the destination page number. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8472 if (!new_window)
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8473 dest_page_num = pidgin_conv_get_tab_at_xy(dest_win,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8474 e->x_root, e->y_root, &to_right);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8475
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8476 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
8477
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8478 if (win == dest_win) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8479 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
8480 } else {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8481 pidgin_conv_window_remove_gtkconv(win, gtkconv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8482 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
8483 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
8484 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
8485 if (new_window) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8486 gint win_width, win_height;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8487
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8488 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
8489 &win_width, &win_height);
19614
16776040e347 ifdef win32 the conversation placement code
Sean Egan <seanegan@gmail.com>
parents: 19600
diff changeset
8490 #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
8491 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
8492 e->x_root - (win_width / 2),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8493 e->y_root - (win_height / 2));
19614
16776040e347 ifdef win32 the conversation placement code
Sean Egan <seanegan@gmail.com>
parents: 19600
diff changeset
8494 #endif
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8495
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8496 pidgin_conv_window_show(dest_win);
15374
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8499
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8500 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
8501
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8502 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8503 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8504
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8505
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8506 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8507 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
8508 gpointer user_data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8509 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8510 PidginWindow *win;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8511 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8512 PidginConversation *gtkconv;
15374
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 win = user_data;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8515 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
8516
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8517 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8518
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8519 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
8520 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8521
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8522 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8523
17278
591d6c3e9f1f Stop the typing icon timer before switching conversations so the typing
Stu Tomlinson <stu@nosnilmot.com>
parents: 17257
diff changeset
8524 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
8525 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
8526 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
8527 }
591d6c3e9f1f Stop the typing icon timer before switching conversations so the typing
Stu Tomlinson <stu@nosnilmot.com>
parents: 17257
diff changeset
8528
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8529 stop_anim(NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8530 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8531 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8532 close_window(GtkWidget *w, PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8533 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8534 close_win_cb(w, NULL, win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8535 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8536
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8537 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8538 detach_tab_cb(GtkWidget *w, GObject *menu)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8539 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8540 PidginWindow *win, *new_window;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8541 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8542
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8543 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
8544
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8545 if (!gtkconv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8546 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8547
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8548 win = pidgin_conv_get_window(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8549 /* 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
8550 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
8551 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8552
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8553 pidgin_conv_window_remove_gtkconv(win, gtkconv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8554
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8555 new_window = pidgin_conv_window_new();
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8556 pidgin_conv_window_add_gtkconv(new_window, gtkconv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8557 pidgin_conv_window_show(new_window);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8560 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8561 close_others_cb(GtkWidget *w, GObject *menu)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8562 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8563 GList *iter;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8564 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8565 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8566
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8567 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
8568
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8569 if (!gtkconv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8570 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8571
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8572 win = pidgin_conv_get_window(gtkconv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8573
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8574 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
8575 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8576 PidginConversation *gconv = iter->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8577 iter = iter->next;
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 if (gconv != gtkconv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8580 {
18797
0622a7f08dde smaller close buttons on tabs. I think this looks really good.
Sean Egan <seanegan@gmail.com>
parents: 18796
diff changeset
8581 close_conv_cb(NULL, NULL, gconv);
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 }
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 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
8587 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8588 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8589
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8590 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
8591
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8592 if (gtkconv)
18797
0622a7f08dde smaller close buttons on tabs. I think this looks really good.
Sean Egan <seanegan@gmail.com>
parents: 18796
diff changeset
8593 close_conv_cb(NULL, NULL, 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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8596 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8597 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
8598 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8599 GtkWidget *item, *menu;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8600 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8601
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8602 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
8603 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8604
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8605 gtkconv = pidgin_conv_window_get_gtkconv_at_index(win,
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8606 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
8607
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8608 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
8609 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8610 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
8611 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8612 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8613
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8614 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
8615
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8616 menu = notebook->menu;
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
8617 pidgin_separator(GTK_WIDGET(menu));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8618
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8619 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
8620 gtk_widget_show(item);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8621 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
8622 g_signal_connect(G_OBJECT(item), "activate",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8623 G_CALLBACK(close_others_cb), menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8624
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8625 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
8626 gtk_widget_show(item);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8627 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
8628 g_signal_connect(G_OBJECT(item), "activate",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8629 G_CALLBACK(close_window), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8630
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
8631 pidgin_separator(menu);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8632
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8633 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
8634 gtk_widget_show(item);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8635 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
8636 g_signal_connect(G_OBJECT(item), "activate",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8637 G_CALLBACK(detach_tab_cb), menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8638
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8639 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
8640 gtk_widget_show(item);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8641 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
8642 g_signal_connect(G_OBJECT(item), "activate",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8643 G_CALLBACK(close_tab_cb), menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8644
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8645 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8646 }
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 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
8649 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
8650 {
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
8651 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
8652 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
8653 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
8654 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
8655 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
8656 }
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
8657
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
8658 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
8659 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
8660 {
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
8661 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
8662 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
8663 }
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
8664
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
8665 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
8666 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
8667 {
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
8668 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
8669 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
8670 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
8671 }
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
8672 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
8673 }
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
8674
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
8675 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
8676 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
8677 {
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
8678 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
8679 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
8680 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
8681 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
8682
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
8683 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
8684 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
8685 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
8686 }
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
8687 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
8688 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
8689 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
8690
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
8691 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
8692 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
8693 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
8694 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
8695 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
8696 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
8697 }
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
8698 serv_alias_buddy(buddy);
21731
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8699 } 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
8700 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
8701 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
8702 }
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
8703 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
8704 }
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
8705
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
8706 static gboolean
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8707 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
8708 {
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
8709 GtkWidget *entry = NULL;
21731
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8710 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
8711 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
8712
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
8713 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
8714 /* 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
8715 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
8716 }
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
8717
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
8718 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
8719 /* 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
8720 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
8721 }
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
8722
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
8723 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
8724 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
8725 if (!buddy)
21731
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8726 /* 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
8727 return FALSE;
21731
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8728
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
8729 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
8730 } 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
8731 PurpleConnection *gc;
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8732 PurplePluginProtocolInfo *prpl_info = NULL;
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8733
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8734 gc = purple_conversation_get_gc(conv);
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8735 if (gc != NULL)
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8736 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8737 if (prpl_info && prpl_info->set_chat_topic == NULL)
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8738 /* 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
8739 return FALSE;
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8740
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
8741 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
8742 }
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
8743
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
8744 /* 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
8745 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
8746 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
8747 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
8748 #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
8749 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
8750 #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
8751
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
8752 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
8753 /* 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
8754 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
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 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
8757 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
8758 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
8759
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8760 if (text != NULL)
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8761 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
8762 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
8763 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
8764 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
8765
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8766 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8767 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8768
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8769 static gboolean
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8770 window_keypress_cb(GtkWidget *widget, GdkEventKey *event, PidginWindow *win)
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8771 {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8772 PidginConversation *gtkconv = pidgin_conv_window_get_active_gtkconv(win);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8773
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8774 return conv_keypress_common(gtkconv, event);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8775 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8776
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
8777 static void
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8778 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
8779 gpointer user_data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8780 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8781 PidginWindow *win;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8782 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8783 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8784 const char *sound_method;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8785
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8786 win = user_data;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8787 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
8788 conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8789
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8790 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8791
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8792 /* clear unseen flag if conversation is not hidden */
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8793 if(!pidgin_conv_is_hidden(gtkconv)) {
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
8794 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
8795 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8796
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8797 /* Update the menubar */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8798
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8799 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
8800 purple_conversation_is_logging(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8801
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8802 generate_send_to_items(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8803 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
8804 regenerate_plugins_items(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8805
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8806 pidgin_conv_switch_active_conversation(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8807
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
8808 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
8809 if (strcmp(sound_method, "none") != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8810 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
8811 gtkconv->make_sound);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8812
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8813 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
8814 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
8815
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8816 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
8817 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
8818
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8819 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8820 * 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
8821 * 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
8822 */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8823 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
8824 (gtkconv->u.im->animate))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8825 start_anim(NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8826
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8827 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
8828 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8829
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8830 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8831 * GTK+ window ops
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8832 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8833
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8834 GList *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8835 pidgin_conv_windows_get_list()
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8836 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8837 return window_list;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8838 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8839
16315
ee4ce3c4186f Fix #248 (Control shouldn't steal focus from scrollback)
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16286
diff changeset
8840 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
8841 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
8842 {
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8843 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
8844 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
8845 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
8846 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
8847 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
8848 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
8849 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
8850 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
8851 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
8852 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
8853 }
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8854
16315
ee4ce3c4186f Fix #248 (Control shouldn't steal focus from scrollback)
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16286
diff changeset
8855 static void
ee4ce3c4186f Fix #248 (Control shouldn't steal focus from scrollback)
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16286
diff changeset
8856 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
8857 {
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8858 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
8859 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
8860 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
8861 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
8862 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
8863 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
8864 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
8865 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
8866 }
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8867
17392
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
8868 static void
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
8869 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
8870 {
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
8871 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
8872 }
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
8873
18328
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8874 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
8875 int x, y;
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8876
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8877 if (GTK_WIDGET_VISIBLE(w))
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8878 gtk_window_get_position(GTK_WINDOW(w), &x, &y);
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8879 else
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8880 return FALSE; /* carry on normally */
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8881
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8882 /* Workaround for GTK+ bug # 169811 - "configure_event" is fired
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8883 * when the window is being maximized */
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8884 if (gdk_window_get_state(w->window) & GDK_WINDOW_STATE_MAXIMIZED)
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8885 return FALSE;
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8886
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8887 /* don't save off-screen positioning */
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8888 if (x + event->width < 0 ||
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8889 y + event->height < 0 ||
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8890 x > gdk_screen_width() ||
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8891 y > gdk_screen_height())
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8892 return FALSE; /* carry on normally */
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8893
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
8894 /* 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
8895 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
8896 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
8897 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
8898 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
8899
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8900 /* continue to handle event normally */
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8901 return FALSE;
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8902
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8903 }
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8904
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
8905 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
8906 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
8907 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
8908 {
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
8909 /* 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
8910 * 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
8911 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
8912 !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
8913
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
8914 /* ...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
8915 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
8916 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
8917 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
8918 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
8919
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
8920 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
8921 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
8922 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
8923 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
8924
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
8925 /* ...and move it back. */
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
8926 gtk_window_move(GTK_WINDOW(win->window), conv_x, conv_y);
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
8927 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
8928 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
8929 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
8930
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
8931 static void
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
8932 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
8933 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
8934 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
8935 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
8936 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
8937 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
8938 }
672dd03f538a More work on the conversation sizing/positioning stuff. Still nothing IM or chat specific
Sean Egan <seanegan@gmail.com>
parents: 18621
diff changeset
8939
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8940 PidginWindow *
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8941 pidgin_conv_window_new()
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8942 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8943 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8944 GtkPositionType pos;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8945 GtkWidget *testidea;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8946 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
8947 #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
8948 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
8949 #endif
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8950
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8951 win = g_malloc0(sizeof(PidginWindow));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8952
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8953 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
8954
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8955 /* Create the window. */
17166
92c3c2eeba87 Added to gtkutils.c:
Gabriel Schulhof <nix@go-nix.ca>
parents: 17116
diff changeset
8956 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
8957 #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
8958 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
8959 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
8960 #endif
18625
672dd03f538a More work on the conversation sizing/positioning stuff. Still nothing IM or chat specific
Sean Egan <seanegan@gmail.com>
parents: 18621
diff changeset
8961 pidgin_conv_restore_position(win);
17260
baaf2cf9339c disapproval of revision '1f819f5ad330efa81ac7906f854b46f0c8bbd7b6'
Ethan Blanton <elb@pidgin.im>
parents: 17259
diff changeset
8962
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8963 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
8964 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
8965 }
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8966
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8967 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
8968 G_CALLBACK(close_win_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8969 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
8970 G_CALLBACK(focus_win_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8971
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8972 /* Intercept keystrokes from the menu items */
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8973 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
8974 G_CALLBACK(window_keypress_cb), win);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8975
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8976
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8977 /* Create the notebook. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8978 win->notebook = gtk_notebook_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8979
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
8980 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
8981
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8982 #if 0
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8983 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
8984 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
8985 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8986 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
8987 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
8988 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
8989 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
8990 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
8991
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8992 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
8993 G_CALLBACK(right_click_menu_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8994
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8995 gtk_widget_show(win->notebook);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8996
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8997 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
8998 G_CALLBACK(before_switch_conv_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8999 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
9000 G_CALLBACK(switch_conv_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9001
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9002 /* Setup the tab drag and drop signals. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9003 gtk_widget_add_events(win->notebook,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9004 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
9005 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
9006 G_CALLBACK(notebook_press_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9007 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
9008 G_CALLBACK(notebook_release_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9009
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9010 testidea = gtk_vbox_new(FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9011
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9012 /* Setup the menubar. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9013 menubar = setup_menubar(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9014 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
9015
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9016 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
9017
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9018 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
9019
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9020 gtk_widget_show(testidea);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9021
17392
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
9022 /* 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
9023 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
9024 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
9025 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
9026 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
9027
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
9028
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9029 #ifdef _WIN32
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9030 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
9031 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
9032
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
9033 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
9034 && !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
9035 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
9036 #endif
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 return win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9039 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9040
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9041 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9042 pidgin_conv_window_destroy(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9043 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9044 purple_prefs_disconnect_by_handle(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9045 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
9046
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9047 /* 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
9048 if (win->dialogs.search)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9049 gtk_widget_destroy(win->dialogs.search);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9050
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9051 if (win->gtkconvs) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9052 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
9053 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
9054 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
9055 if (last)
fee0eea83e58 Honour the persistency when closing the window from the WM.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20051
diff changeset
9056 break;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9057 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9058 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9059 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9060 gtk_widget_destroy(win->window);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9061
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9062 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
9063
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9064 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
9065 purple_signals_disconnect_by_handle(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9066
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9067 g_free(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9068 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9069
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9070 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9071 pidgin_conv_window_show(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9072 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9073 gtk_widget_show(win->window);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9074 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9075
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9076 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9077 pidgin_conv_window_hide(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9078 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9079 gtk_widget_hide(win->window);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9082 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9083 pidgin_conv_window_raise(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9084 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9085 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
9086 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9087
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9088 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9089 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
9090 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9091 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
9092 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
9093 gtkconv->tab_cont));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9094 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9095
18864
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9096 static gboolean
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9097 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
9098 {
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
9099 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
9100 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
9101 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
9102 }
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
9103
18864
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9104 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
9105 gdk_window_set_cursor(event->window, ptr);
18864
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9106 return FALSE;
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9107 }
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9108
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9109 static gboolean
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9110 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
9111 {
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
9112 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
9113 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
9114 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
9115 }
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
9116
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
9117 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
9118 gdk_window_set_cursor(event->window, hand);
18864
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9119 return FALSE;
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9120 }
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9121
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9122 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9123 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
9124 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9125 PurpleConversation *conv = gtkconv->active_conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9126 PidginConversation *focus_gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9127 GtkWidget *tab_cont = gtkconv->tab_cont;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9128 GtkWidget *close_image;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9129 PurpleConversationType conv_type;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9130 const gchar *tmp_lab;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9131
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9132 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
9133
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9134 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
9135 gtkconv->win = win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9136
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
9137 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
9138 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
9139
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
9140
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9141 /* Close button. */
18797
0622a7f08dde smaller close buttons on tabs. I think this looks really good.
Sean Egan <seanegan@gmail.com>
parents: 18796
diff changeset
9142 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
9143 #if GTK_CHECK_VERSION(2,4,0)
18821
0765cf9331f6 warning fixes
Sean Egan <seanegan@gmail.com>
parents: 18820
diff changeset
9144 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
9145 #endif
18864
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9146 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
9147 close_image = gtk_label_new("×");
18864
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9148 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
9149 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
9150 gtk_widget_show(close_image);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9151 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
9152 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
9153 _("Close conversation"), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9154
18797
0622a7f08dde smaller close buttons on tabs. I think this looks really good.
Sean Egan <seanegan@gmail.com>
parents: 18796
diff changeset
9155 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
9156 G_CALLBACK(close_conv_cb), gtkconv);
15374
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 #if !GTK_CHECK_VERSION(2,6,0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9159 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9160 * 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
9161 * border bug. I love you guys! -- ChipX86
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9162 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9163 /* 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
9164 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
9165 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
9166 #endif
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 /* Status icon. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9169 gtkconv->icon = gtk_image_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9170 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
9171 gtk_widget_show(gtkconv->icon);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9172 update_tab_icon(conv);
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 /* Tab label. */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9175 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
9176 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
9177
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9178 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
9179 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
9180 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
9181
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9182 gtk_widget_show_all(gtkconv->menu_icon);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9183
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9184 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
9185 gtk_widget_show(gtkconv->menu_label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9186 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
9187
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9188 gtk_widget_show(gtkconv->menu_tabby);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9189
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9190 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
9191 pidgin_conv_update_buddy_icon(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9192
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9193 /* Build and set conversations tab */
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9194 pidgin_conv_tab_pack(win, gtkconv);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9195
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9196 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
9197
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9198 gtk_widget_show(tab_cont);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9199
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9200 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
9201 /* 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
9202 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
9203 } else {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9204 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
9205 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9206
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9207 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
9208 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
9209 gtk_widget_grab_focus(focus_gtkconv->entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9210
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9211 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
9212 update_send_to_selection(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9213 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9214
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9215 static void
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9216 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
9217 {
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9218 gboolean tabs_side = FALSE;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9219 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
9220 GtkWidget *first, *third, *ebox;
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9221
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9222 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
9223 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
9224 tabs_side = TRUE;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9225 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
9226 angle = 90;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9227 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
9228 angle = 270;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9229
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9230 #if GTK_CHECK_VERSION(2,6,0)
19361
272d08484f7d remove obsolote GNOME color pallete
Sean Egan <seanegan@gmail.com>
parents: 19335
diff changeset
9231 if (!angle) {
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9232 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
9233 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
9234 } else {
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9235 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
9236 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
9237 }
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
9238
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9239 if (tabs_side) {
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9240 gtk_label_set_width_chars(
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9241 GTK_LABEL(gtkconv->tab_label),
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9242 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
9243 );
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9244 }
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
9245
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
9246 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
9247 #endif
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9248
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9249 #if 0
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9250 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
9251 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
9252 #endif
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9253
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9254 if (angle)
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9255 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
9256 else
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9257 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
9258 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
9259
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9260 /* select the correct ordering for verticle tabs */
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9261 if (angle == 90) {
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9262 first = gtkconv->close;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9263 third = gtkconv->icon;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9264 } else {
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9265 first = gtkconv->icon;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9266 third = gtkconv->close;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9267 }
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9268
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
9269 ebox = gtk_event_box_new();
17423
ae30f9913bb4 Fix for gtk < 2.4
Stu Tomlinson <stu@nosnilmot.com>
parents: 17294
diff changeset
9270 #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
9271 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
9272 #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
9273 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
9274
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9275 if (gtkconv->tab_label->parent == NULL) {
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9276 /* Pack if it's a new widget */
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9277 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
9278 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
9279 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
9280
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9281 /* 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
9282 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
9283 } else {
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9284 /* reparent old widgets on preference changes */
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9285 gtk_widget_reparent(first, gtkconv->tabby);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9286 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
9287 gtk_widget_reparent(third, gtkconv->tabby);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9288 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
9289 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
9290 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
9291
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9292 /* 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
9293 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
9294 }
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9295
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
9296 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
9297 !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
9298 TRUE, GTK_PACK_START);
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9299
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
9300 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
9301 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
9302 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
9303 (!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
9304 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
9305
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9306 /* 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
9307 /* gtk_widget_show(gtkconv->icon); */
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9308 gtk_widget_show(gtkconv->tab_label);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9309 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
9310 gtk_widget_show(gtkconv->close);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9311 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
9312 gtk_widget_show(ebox);
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9313 }
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9314
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9315 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9316 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
9317 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9318 unsigned int index;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9319 PurpleConversationType conv_type;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9320
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9321 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
9322 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
9323
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9324 g_object_ref(gtkconv->tab_cont);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9325 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
9326
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9327 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
9328
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9329 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
9330
19681
c35e8c057441 Fix a crash in window-placement.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19680
diff changeset
9331 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
9332 0, 0, NULL, NULL, gtkconv);
c35e8c057441 Fix a crash in window-placement.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19680
diff changeset
9333
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
9334 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
9335 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
9336
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9337 if (!win->gtkconvs && win != hidden_convwin)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9338 pidgin_conv_window_destroy(win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9339 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9340
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9341 PidginConversation *
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9342 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
9343 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9344 GtkWidget *tab_cont;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9345
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9346 if (index == -1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9347 index = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9348 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
9349 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
9350 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9351
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9352 PidginConversation *
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9353 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
9354 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9355 int index;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9356 GtkWidget *tab_cont;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9357
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9358 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
9359 if (index == -1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9360 index = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9361 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
9362 if (!tab_cont)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9363 return NULL;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9364 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
9365 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9366
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9367
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9368 PurpleConversation *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9369 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
9370 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9371 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9372
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9373 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
9374 return gtkconv ? gtkconv->active_conv : NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9375 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9376
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9377 gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9378 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
9379 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9380 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
9381 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9382
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9383 gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9384 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
9385 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9386 gboolean has_focus = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9387
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9388 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
9389
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9390 return has_focus;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9391 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9392
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9393 PidginWindow *
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9394 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
9395 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9396 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9397 GdkWindow *gdkwin;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9398 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9399
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9400 gdkwin = gdk_window_at_pointer(&x, &y);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9401
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9402 if (gdkwin)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9403 gdkwin = gdk_window_get_toplevel(gdkwin);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9404
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9405 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
9406 win = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9407
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9408 if (gdkwin == win->window->window)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9409 return win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9410 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9411
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9412 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9413 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9414
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9415 GList *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9416 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
9417 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9418 return win->gtkconvs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9419 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9420
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9421 guint
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9422 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
9423 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9424 return g_list_length(win->gtkconvs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9425 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9426
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9427 PidginWindow *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9428 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
9429 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9430 GList *wins, *convs;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9431 PidginWindow *win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9432 PidginConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9433
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9434 if (type == PURPLE_CONV_TYPE_UNKNOWN)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9435 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9436
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9437 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
9438 win = wins->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9439
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9440 for (convs = win->gtkconvs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9441 convs != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9442 convs = convs->next) {
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 conv = convs->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9445
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9446 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
9447 return win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9448 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9449 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9450
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9451 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9452 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9453
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9454 PidginWindow *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9455 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
9456 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9457 GList *wins, *convs;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9458 PidginWindow *win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9459 PidginConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9460
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9461 if (type == PURPLE_CONV_TYPE_UNKNOWN)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9462 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9463
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9464 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
9465 wins != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9466 wins = wins->prev) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9467
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9468 win = wins->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9469
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9470 for (convs = win->gtkconvs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9471 convs != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9472 convs = convs->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9473
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9474 conv = convs->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9475
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9476 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
9477 return win;
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 }
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 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9482 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9483
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9484
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9485 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9486 * Conversation placement functions
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9487 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9488 typedef struct
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9489 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9490 char *id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9491 char *name;
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
9492 PidginConvPlacementFunc fnc;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9493
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9494 } ConvPlacementData;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9495
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9496 static GList *conv_placement_fncs = NULL;
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
9497 static PidginConvPlacementFunc place_conv = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9498
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9499 /* 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
9500 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9501 conv_placement_last_created_win(PidginConversation *conv)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9502 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9503 PidginWindow *win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9504
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9505 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
9506 win = l ? l->data : NULL;;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9507
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9508 if (win == NULL) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9509 win = pidgin_conv_window_new();
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9510
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9511 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
9512 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
9513
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9514 pidgin_conv_window_add_gtkconv(win, conv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9515 pidgin_conv_window_show(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9516 } else {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9517 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
9518 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9519 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9520
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9521 /* 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
9522 static gboolean
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9523 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
9524 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
9525 {
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9526 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
9527 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
9528 GList *all;
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9529
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9530 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
9531 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
9532 else
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9533 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
9534
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9535 /* 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
9536 * 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
9537 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
9538 return FALSE;
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9539
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9540 /* 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
9541 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
9542 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
9543 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
9544 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
9545 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
9546
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9547 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
9548 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
9549 /* 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
9550 return FALSE;
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9551 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9552 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9553
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9554 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
9555 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
9556 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
9557 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
9558 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
9559 } 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
9560 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
9561 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
9562 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
9563 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
9564 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9565
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9566 return FALSE;
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9567 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9568
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9569 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9570 conv_placement_last_created_win_type(PidginConversation *conv)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9571 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9572 PidginWindow *win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9573
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9574 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
9575
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9576 if (win == NULL) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9577 win = pidgin_conv_window_new();
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9578
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9579 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
9580 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
9581 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
9582 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
9583 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
9584 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
9585 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
9586 } 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
9587 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
9588 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
9589 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
9590 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
9591 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
9592 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9593
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9594 pidgin_conv_window_add_gtkconv(win, conv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9595 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
9596
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9597 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
9598 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
9599 } else
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9600 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
9601 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9602
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9603 /* 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
9604 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9605 conv_placement_new_window(PidginConversation *conv)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9606 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9607 PidginWindow *win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9608
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9609 win = pidgin_conv_window_new();
18791
f36fc45b7866 really make restoring size and position work
Ka-Hing Cheung <khc@hxbc.us>
parents: 18790
diff changeset
9610
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9611 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
9612 G_CALLBACK(gtk_conv_configure_cb), NULL);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9613
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9614 pidgin_conv_window_add_gtkconv(win, conv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9615
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9616 pidgin_conv_window_show(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9617 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9618
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9619 static PurpleGroup *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9620 conv_get_group(PidginConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9621 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9622 PurpleGroup *group = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9623
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9624 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
9625 PurpleBuddy *buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9626
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9627 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
9628 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
9629
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9630 if (buddy != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9631 group = purple_buddy_get_group(buddy);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9632
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9633 } 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
9634 PurpleChat *chat;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9635
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9636 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
9637 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
9638
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9639 if (chat != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9640 group = purple_chat_get_group(chat);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9641 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9642
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9643 return group;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9644 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9645
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9646 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9647 * 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
9648 * 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
9649 * open windows will get a new window.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9650 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9651 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9652 conv_placement_by_group(PidginConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9653 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9654 PurpleConversationType type;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9655 PurpleGroup *group = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9656 GList *wl, *cl;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9657
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9658 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
9659
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9660 group = conv_get_group(conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9661
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9662 /* 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
9663 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
9664 PidginWindow *win2;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9665 PidginConversation *conv2;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9666 PurpleGroup *group2 = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9667
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9668 win2 = wl->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9669
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9670 for (cl = win2->gtkconvs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9671 cl != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9672 cl = cl->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9673 conv2 = cl->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9674
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9675 group2 = conv_get_group(conv2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9676
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9677 if (group == group2) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9678 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
9679
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9680 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9681 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9682 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9683 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9684
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9685 /* Make a new window. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9686 conv_placement_new_window(conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9687 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9688
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9689 /* 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
9690 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9691 conv_placement_by_account(PidginConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9692 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9693 PurpleConversationType type;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9694 GList *wins, *convs;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9695 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9696
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9697 account = purple_conversation_get_account(conv->active_conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9698 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
9699
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9700 /* 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
9701 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
9702 PidginWindow *win2;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9703 PidginConversation *conv2;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9704
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9705 win2 = wins->data;
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 for (convs = win2->gtkconvs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9708 convs != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9709 convs = convs->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9710 conv2 = convs->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9711
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9712 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
9713 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
9714 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9715 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9716 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9717 }
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 /* Make a new window. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9720 conv_placement_new_window(conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9721 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9722
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9723 static ConvPlacementData *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9724 get_conv_placement_data(const char *id)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9725 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9726 ConvPlacementData *data = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9727 GList *n;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9728
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9729 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
9730 data = n->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9731 if (!strcmp(data->id, id))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9732 return data;
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 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9736 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9737
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9738 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9739 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
9740 PidginConvPlacementFunc fnc)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9741 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9742 ConvPlacementData *data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9743
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9744 data = g_new(ConvPlacementData, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9745
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9746 data->id = g_strdup(id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9747 data->name = g_strdup(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9748 data->fnc = fnc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9749
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9750 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
9751 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9752
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9753 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9754 ensure_default_funcs(void)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9755 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9756 if (conv_placement_fncs == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9757 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
9758 conv_placement_last_created_win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9759 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
9760 conv_placement_last_created_win_type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9761 add_conv_placement_fnc("new", _("New window"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9762 conv_placement_new_window);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9763 add_conv_placement_fnc("group", _("By group"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9764 conv_placement_by_group);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9765 add_conv_placement_fnc("account", _("By account"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9766 conv_placement_by_account);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9767 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9768 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9769
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9770 GList *
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9771 pidgin_conv_placement_get_options(void)
15374
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 GList *n, *list = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9774 ConvPlacementData *data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9775
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9776 ensure_default_funcs();
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 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
9779 data = n->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9780 list = g_list_append(list, data->name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9781 list = g_list_append(list, data->id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9782 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9783
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9784 return list;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9785 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9786
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9787
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9788 void
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9789 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
9790 PidginConvPlacementFunc fnc)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9791 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9792 g_return_if_fail(id != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9793 g_return_if_fail(name != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9794 g_return_if_fail(fnc != NULL);
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 ensure_default_funcs();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9797
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9798 add_conv_placement_fnc(id, name, fnc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9799 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9800
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9801 void
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9802 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
9803 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9804 ConvPlacementData *data = get_conv_placement_data(id);
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 if (data == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9807 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9808
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9809 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
9810
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9811 g_free(data->id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9812 g_free(data->name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9813 g_free(data);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9816 const char *
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9817 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
9818 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9819 ConvPlacementData *data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9820
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9821 ensure_default_funcs();
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 data = get_conv_placement_data(id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9824
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9825 if (data == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9826 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9827
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9828 return data->name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9829 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9830
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
9831 PidginConvPlacementFunc
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9832 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
9833 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9834 ConvPlacementData *data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9835
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9836 ensure_default_funcs();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9837
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9838 data = get_conv_placement_data(id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9839
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9840 if (data == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9841 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9842
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9843 return data->fnc;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9846 void
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
9847 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
9848 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9849 g_return_if_fail(func != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9850
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9851 /* 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
9852 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
9853 place_conv = func;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9854 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9855 place_conv = NULL;
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
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
9858 PidginConvPlacementFunc
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9859 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
9860 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9861 return place_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9862 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9863
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9864 void
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9865 pidgin_conv_placement_place(PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9866 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9867 if (place_conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9868 place_conv(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9869 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9870 conv_placement_new_window(gtkconv);
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 gboolean
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9874 pidgin_conv_is_hidden(PidginConversation *gtkconv)
15374
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 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
9877
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9878 return (gtkconv->win == hidden_convwin);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9879 }
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9882 /* 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
9883 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9884 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
9885 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9886 gulong fg_brightness;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9887 gulong bg_brightness;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9888 gulong br_diff;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9889 gulong col_diff;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9890 int fred, fgreen, fblue, bred, bgreen, bblue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9891
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9892 /* 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
9893 * 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
9894 * 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
9895 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9896
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9897 fred = foreground.red >> 8 ;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9898 fgreen = foreground.green >> 8 ;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9899 fblue = foreground.blue >> 8 ;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9900
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9901
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9902 bred = background.red >> 8 ;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9903 bgreen = background.green >> 8 ;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9904 bblue = background.blue >> 8 ;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9905
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9906 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
9907 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
9908 br_diff = abs(fg_brightness - bg_brightness);
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 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
9911
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9912 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
9913 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9914
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9915
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9916 static GdkColor*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9917 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
9918 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9919 guint numcolors = *color_count;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9920 guint i = 0, j = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9921 GdkColor *colors = g_new(GdkColor, numcolors);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9922 GdkColor nick_highlight;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9923 GdkColor send_color;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9924 time_t breakout_time;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9925
21840
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
9926 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
9927 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
9928
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9929 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
9930
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9931 breakout_time = time(NULL) + 3;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9932
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9933 /* 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
9934 * 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
9935 * numcolors of them that do
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9936 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9937 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
9938 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9939 GdkColor color = nick_seed_colors[j];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9940
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9941 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
9942 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
9943 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
9944 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9945 colors[i] = color;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9946 i++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9947 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9948 j++;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9951 /* 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
9952 * 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
9953 * 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
9954 * conflict with each other.
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 while(i < numcolors && time(NULL) < breakout_time)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9957 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9958 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
9959
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9960 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
9961 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
9962 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
9963 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9964 colors[i] = color;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9965 i++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9966 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9967 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9968
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9969 if (i < numcolors) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9970 GdkColor *c = colors;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9971 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
9972 colors = g_memdup(c, i * sizeof(GdkColor));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9973 g_free(c);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9974 *color_count = i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9975 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9976
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9977 return colors;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9978 }