annotate pidgin/gtkconv.c @ 21951:800ede833f99

Patch from QuLogic to prevent multiple alias editing fields in the infopane. Fixes #4467. committer: John Bailey <rekkanoryo@rekkanoryo.org>
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 29 Dec 2007 04:26:17 +0000
parents 3fc5862b834a
children cca516eb7610 1494e0a0f2b9
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
444 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
445 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
446 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
447 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
448 g_free(markup);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
449
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
450 switch (status) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
451 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
452 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
453 break;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
454 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
455 {
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
456 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
457 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
458
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
459 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
460 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
461
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
462 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
463 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
464 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
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 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
467 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
468 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
469 } else {
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
470 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
471 }
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 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
474 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
475 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
476 }
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
477 }
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
478 break;
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
479 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
480 case PURPLE_CMD_STATUS_WRONG_ARGS:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
481 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
482 "to that command."),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
483 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
484 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
485 break;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
486 case PURPLE_CMD_STATUS_FAILED:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
487 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
488 PURPLE_MESSAGE_NO_LOG, time(NULL));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
489 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
490 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
491 break;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
492 case PURPLE_CMD_STATUS_WRONG_TYPE:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
493 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
494 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
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 else
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
497 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
498 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
499 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
500 break;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
501 case PURPLE_CMD_STATUS_WRONG_PRPL:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
502 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
503 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
504 retval = TRUE;
62a71bb085ef Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents: 18025
diff changeset
505 break;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
506 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
507 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
508
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
509 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
510 return retval;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
511 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
512
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
513 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
514 send_cb(GtkWidget *widget, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
515 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
516 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
517 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
518 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
519 PurpleMessageFlags flags = 0;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
520 char *buf, *clean;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
521
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
522 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
523
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
524 if (check_for_and_do_command(conv)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
525 if (gtkconv->entry_growing) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
526 gtkconv->entry_growing = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
527 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
528 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
529 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
530 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
531
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
532 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
533 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
534 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
535
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
536 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
537 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
538
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
539 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
540 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
541
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
542 gtk_widget_grab_focus(gtkconv->entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
543
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
544 if (strlen(clean) == 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
545 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
546 g_free(clean);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
547 return;
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
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
550 purple_idle_touch();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
551
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
552 /* 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
553 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
554 flags |= PURPLE_MESSAGE_IMAGES;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
555
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
556 gc = purple_account_get_connection(account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
557 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
558 char **bufs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
559 int i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
560
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
561 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
562 for (i = 0; bufs[i]; i++) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
563 send_history_add(gtkconv, bufs[i]);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
564 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
565 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
566 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
567 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
568 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
569
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
570 g_strfreev(bufs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
571
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
572 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
573 send_history_add(gtkconv, buf);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
574 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
575 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
576 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
577 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
578 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
579
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
580 g_free(clean);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
581 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
582
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
583 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
584 if (gtkconv->entry_growing) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
585 gtkconv->entry_growing = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
586 }
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
587 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
588 }
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 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
591 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
592 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
593 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
594 const char *name;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
595 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
596
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
597 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
598 name = purple_conversation_get_name(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
599
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
600 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
601 PurpleBuddy *b;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
602
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
603 b = purple_find_buddy(account, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
604 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
605 pidgin_dialogs_remove_buddy(b);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
606 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
607 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
608 } 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
609 PurpleChat *c;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
610
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
611 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
612 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
613 pidgin_dialogs_remove_chat(c);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
614 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
615 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
616 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
617
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
618 gtk_widget_grab_focus(PIDGIN_CONVERSATION(conv)->entry);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
619 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
620
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
621 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
622 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
623 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
624 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
625
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
626 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
627 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
628 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
629 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
630
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
631
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
632 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
633 info_cb(GtkWidget *widget, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
634 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
635 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
636
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
637 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
638 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
639 purple_conversation_get_name(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
640 gtk_widget_grab_focus(gtkconv->entry);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
641 } 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
642 /* 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
643 PidginChatPane *gtkchat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
644 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
645 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
646 GtkTreeSelection *sel;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
647 char *name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
648
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
649 gtkchat = gtkconv->u.chat;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
650
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
651 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
652 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
653
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
654 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
655 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
656 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
657 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
658
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
659 chat_do_info(gtkconv, name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
660 g_free(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
661 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
662 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
663
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
664 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
665 block_cb(GtkWidget *widget, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
666 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
667 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
668 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
669
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
670 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
671
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
672 if (account != NULL && purple_account_is_connected(account))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
673 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
674
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
675 gtk_widget_grab_focus(PIDGIN_CONVERSATION(conv)->entry);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
676 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
677
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
678 static void
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
679 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
680 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
681 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
682 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
683
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
684 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
685
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
686 if (account != NULL && purple_account_is_connected(account))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
687 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
688
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
689 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
690 }
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
691
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
692 static void
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
693 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
694 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
695 const char *buddy, *message;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
696 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
697
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
698 gtkconv = PIDGIN_CONVERSATION(info->conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
699
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
700 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
701 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
702 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
703
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
704 if (!g_ascii_strcasecmp(buddy, ""))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
705 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
706
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
707 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
708 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
709 message, buddy);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
712 gtk_widget_destroy(invite_dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
713 invite_dialog = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
714
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
715 g_free(info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
716 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
717
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
718 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
719 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
720 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
721 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
722 InviteBuddyInfo *info = (InviteBuddyInfo *)data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
723 const char *convprotocol;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
724
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
725 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
726
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
727 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
728 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
729 PurpleBlistNode *node = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
730 PurpleBuddy *buddy;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
731
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
732 memcpy(&node, sd->data, sizeof(node));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
733
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
734 if (PURPLE_BLIST_NODE_IS_CONTACT(node))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
735 buddy = purple_contact_get_priority_buddy((PurpleContact *)node);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
736 else if (PURPLE_BLIST_NODE_IS_BUDDY(node))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
737 buddy = (PurpleBuddy *)node;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
738 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
739 return;
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 (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
742 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
743 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
744 _("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
745 "chat."), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
746 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
747 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
748 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
749
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
750 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
751 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
752 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
753 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
754 char *protocol = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
755 char *username = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
756 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
757
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
758 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
759 &protocol, &username, NULL))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
760 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
761 if (account == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
762 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
763 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
764 _("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
765 "can invite that buddy."), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
766 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
767 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
768 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
769 purple_notify_error(PIDGIN_CONVERSATION(info->conv), NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
770 _("That buddy is not on the same protocol as this "
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
771 "chat."), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
772 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
773 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
774 {
20028
a2b4eac83902 Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19980
diff changeset
775 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
776 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
777 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
778
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
779 g_free(username);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
780 g_free(protocol);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
781
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
782 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
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 static const GtkTargetEntry dnd_targets[] =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
787 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
788 {"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
789 {"application/x-im-contact", 0, 1}
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 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
793 invite_cb(GtkWidget *widget, PidginConversation *gtkconv)
15374
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 PurpleConversation *conv = gtkconv->active_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
796 InviteBuddyInfo *info = NULL;
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 if (invite_dialog == NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
799 PurpleConnection *gc;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
800 PidginWindow *gtkwin;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
801 GtkWidget *label;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
802 GtkWidget *vbox, *hbox;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
803 GtkWidget *table;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
804 GtkWidget *img;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
805
15436
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15435
diff changeset
806 img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_QUESTION,
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15435
diff changeset
807 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
808
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
809 info = g_new0(InviteBuddyInfo, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
810 info->conv = conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
811
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
812 gc = purple_conversation_get_gc(conv);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
813 gtkwin = pidgin_conv_get_window(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
814
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
815 /* Create the new dialog. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
816 invite_dialog = gtk_dialog_new_with_buttons(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
817 _("Invite Buddy Into Chat Room"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
818 GTK_WINDOW(gtkwin->window), 0,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
819 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
15509
23ca11f8a8c4 stock to pidgin
Sean Egan <seanegan@gmail.com>
parents: 15508
diff changeset
820 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
821
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
822 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
823 GTK_RESPONSE_OK);
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
824 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
825 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
826 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
827
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
828 info->window = GTK_WIDGET(invite_dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
829
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
830 /* Setup the outside spacing. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
831 vbox = GTK_DIALOG(invite_dialog)->vbox;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
832
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
833 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
834 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
835
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
836 /* 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
837 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
838 gtk_container_add(GTK_CONTAINER(vbox), hbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
839 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
840 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
841
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
842 /* Setup the right vbox. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
843 vbox = gtk_vbox_new(FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
844 gtk_container_add(GTK_CONTAINER(hbox), vbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
845
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
846 /* Put our happy label in it. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
847 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
848 "to invite, along with an optional invite "
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
849 "message."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
850 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
851 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
852 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
853 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
854
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
855 /* 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
856 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
857 gtk_container_add(GTK_CONTAINER(vbox), hbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
858
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
859 /* 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
860 table = gtk_table_new(2, 2, FALSE);
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
861 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
862 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
863 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
864 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
865
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
866 /* Now the Buddy label */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
867 label = gtk_label_new(NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
868 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
869 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
870 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
871
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
872 /* 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
873 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
874 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
875 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
876
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
877 /* Now the label for "Message" */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
878 label = gtk_label_new(NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
879 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
880 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
881 gtk_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
882
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 /* And finally, the Message entry field. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
885 info->message = gtk_entry_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
886 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
887
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), info->message, 1, 2, 1, 2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
889 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
890
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
891 /* Connect the signals. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
892 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
893 G_CALLBACK(do_invite), info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
894 /* Setup drag-and-drop */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
895 gtk_drag_dest_set(info->window,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
896 GTK_DEST_DEFAULT_MOTION |
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
897 GTK_DEST_DEFAULT_DROP,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
898 dnd_targets,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
899 sizeof(dnd_targets) / sizeof(GtkTargetEntry),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
900 GDK_ACTION_COPY);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
901 gtk_drag_dest_set(info->entry,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
902 GTK_DEST_DEFAULT_MOTION |
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
903 GTK_DEST_DEFAULT_DROP,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
904 dnd_targets,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
905 sizeof(dnd_targets) / sizeof(GtkTargetEntry),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
906 GDK_ACTION_COPY);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
907
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
908 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
909 G_CALLBACK(invite_dnd_recv), info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
910 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
911 G_CALLBACK(invite_dnd_recv), info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
912
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
913 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
914
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
915 gtk_widget_show_all(invite_dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
916
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
917 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
918 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
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 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
922 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
923 {
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
924 pidgin_dialogs_im();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
925 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
926
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
927 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
928 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
929 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
930 PurpleConversation *conv = (PurpleConversation *)user_data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
931 FILE *fp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
932 const char *name;
19665
37429bc82307 I think this fixes #2858.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19655
diff changeset
933 char **lines;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
934 gchar *text;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
935
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
936 if ((fp = g_fopen(filename, "w+")) == NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
937 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
938 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
939 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
940
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
941 name = purple_conversation_get_name(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
942 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
943 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
944
19665
37429bc82307 I think this fixes #2858.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19655
diff changeset
945 lines = gtk_imhtml_get_markup_lines(
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
946 GTK_IMHTML(PIDGIN_CONVERSATION(conv)->imhtml));
19667
a2f5a28ba983 More fix, thanks to SimGuy.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19665
diff changeset
947 text = g_strjoinv("<br>\n", lines);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
948 fprintf(fp, "%s", text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
949 g_free(text);
19665
37429bc82307 I think this fixes #2858.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19655
diff changeset
950 g_strfreev(lines);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
951
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
952 fprintf(fp, "\n</body>\n</html>\n");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
953 fclose(fp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
954 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
955
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
956 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
957 * 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
958 * plaintext v. HTML file.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
959 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
960 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
961 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
962 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
963 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
964 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
965 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
966 const char *name;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
967 gchar *buf;
17195
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
968 gchar *c;
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
969
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
970 if (buddy != NULL)
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
971 name = purple_buddy_get_contact_alias(buddy);
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
972 else
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
973 name = purple_normalize(conv->account, conv->name);
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
974
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
975 buf = g_strdup_printf("%s.html", name);
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
976 for (c = buf ; *c ; c++)
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
977 {
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
978 if (*c == '/' || *c == '\\')
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
979 *c = ' ';
1f0657cd89d3 Conversation -> Save As will now use aliases.
Richard Laager <rlaager@wiktel.com>
parents: 17144
diff changeset
980 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
981 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
982 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
983 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
984 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
985 conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
986
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
987 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
988 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
989
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
990 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
991 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
992 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
993 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
994 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
995 PurpleLogType type;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
996 PidginBuddyList *gtkblist;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
997 GdkCursor *cursor;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
998 const char *name;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
999 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1000 GSList *buddies;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1001 GSList *cur;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1002
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1003 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
1004
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1005 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
1006 type = PURPLE_LOG_IM;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1007 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
1008 type = PURPLE_LOG_CHAT;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1009 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1010 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1011
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1012 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
1013
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1014 cursor = gdk_cursor_new(GDK_WATCH);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1015 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
1016 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
1017 gdk_cursor_unref(cursor);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1018 #if GTK_CHECK_VERSION(2,4,0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1019 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
1020 #else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1021 gdk_flush();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1022 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1023
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1024 name = purple_conversation_get_name(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1025 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1026
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1027 buddies = purple_find_buddies(account, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1028 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
1029 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1030 PurpleBlistNode *node = cur->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1031 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
1032 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1033 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
1034 g_slist_free(buddies);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1035 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
1036 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
1037 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1038 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1039 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1040 g_slist_free(buddies);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1041
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1042 pidgin_log_show(type, name, account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1043
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1044 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
1045 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
1046 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1047
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1048 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1049 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
1050 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1051 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1052 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1053
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1054 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
1055 clear_conversation_scrollback(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1056 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1057
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1058 struct _search {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1059 PidginWindow *gtkwin;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1060 GtkWidget *entry;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1061 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1062
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1063 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
1064 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1065 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1066 PidginConversation *gtk_active_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1067 GList *iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1068
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1069 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
1070 gtk_active_conv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1071
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1072 switch (resp)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1073 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1074 case GTK_RESPONSE_OK:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1075 /* clear highlighting except the active conversation window
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1076 * 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
1077 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
1078 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1079 PidginConversation *gtkconv = iter->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1080
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1081 if (gtkconv != gtk_active_conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1082 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1083 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
1084 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1085 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1086 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1087 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
1088 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
1089 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1090 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1091 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1092
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1093 case GTK_RESPONSE_DELETE_EVENT:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1094 case GTK_RESPONSE_CLOSE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1095 /* 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
1096 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
1097 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1098 PidginConversation *gconv = iter->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1099 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
1100 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1101
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1102 gtk_widget_destroy(s->gtkwin->dialogs.search);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1103 s->gtkwin->dialogs.search = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1104 g_free(s);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1105 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1106 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1107 }
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 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1110 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
1111 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1112 PidginWindow *gtkwin = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1113 GtkWidget *hbox;
15436
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15435
diff changeset
1114 GtkWidget *img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_QUESTION,
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15435
diff changeset
1115 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
1116 GtkWidget *label;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1117 struct _search *s;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1118
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1119 if (gtkwin->dialogs.search) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1120 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
1121 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1122 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1123
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1124 s = g_malloc(sizeof(struct _search));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1125 s->gtkwin = gtkwin;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1126
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1127 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
1128 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
1129 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1130 GTK_STOCK_FIND, GTK_RESPONSE_OK, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1131 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
1132 GTK_RESPONSE_OK);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1133 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
1134 G_CALLBACK(do_search_cb), s);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1135
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
1136 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
1137 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
1138 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
1139 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
1140 gtk_container_set_border_width(
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
1141 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
1142
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
1143 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
1144 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
1145 hbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1146 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
1147
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1148 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
1149 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
1150 GTK_RESPONSE_OK, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1151
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1152 label = gtk_label_new(NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1153 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
1154 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
1155
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1156 s->entry = gtk_entry_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1157 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
1158 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
1159 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
1160 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
1161 gtkwin->dialogs.search);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1162 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
1163
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1164 gtk_widget_show_all(gtkwin->dialogs.search);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1165 gtk_widget_grab_focus(s->entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1166 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1167
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1168 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1169 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
1170 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1171 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1172 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
1173
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1174 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
1175 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
1176 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1177
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1178 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1179
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1180 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1181 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
1182 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1183 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1184 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1185
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1186 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
1187
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1188 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
1189 purple_conversation_get_name(conv), NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1190 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1191
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1192 static void
17776
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1193 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
1194 {
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1195 PidginWindow *win = data;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1196 PidginConversation *gtkconv;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1197 GtkIMHtmlToolbar *toolbar;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1198
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1199 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
1200 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar);
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 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
1203 !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
1204 }
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 static void
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1207 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
1208 {
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1209 PidginWindow *win = data;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1210 PurpleConversation *conv;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1211 PidginConversation *gtkconv;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1212 GtkIMHtmlToolbar *toolbar;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1213
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1214 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
1215 conv = gtkconv->active_conv;
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1216 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar);
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1217
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1218 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
1219 !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
1220 }
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1221
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1222
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
1223 static void
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1224 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
1225 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1226 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1227 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1228 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1229 const char *name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1230
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1231 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
1232 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1233 name = purple_conversation_get_name(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1234
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1235 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
1236 PurpleBuddy *b;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1237
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1238 b = purple_find_buddy(account, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1239 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
1240 pidgin_dialogs_alias_buddy(b);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1241 } 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
1242 PurpleChat *c;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1243
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1244 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
1245 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
1246 pidgin_dialogs_alias_chat(c);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1247 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1248 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1249
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1250 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1251 menu_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
1252 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1253 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1254 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1255
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1256 conv = pidgin_conv_window_get_active_conversation(win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1257
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1258 info_cb(NULL, PIDGIN_CONVERSATION(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1259 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1260
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1261 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1262 menu_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
1263 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1264 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1265 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1266
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1267 conv = pidgin_conv_window_get_active_conversation(win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1268
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1269 invite_cb(NULL, PIDGIN_CONVERSATION(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1270 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1271
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1272 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1273 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
1274 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1275 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1276 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1277
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1278 conv = pidgin_conv_window_get_active_conversation(win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1279
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1280 block_cb(NULL, PIDGIN_CONVERSATION(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1281 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1282
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1283 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
1284 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
1285 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1286 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1287 PurpleConversation *conv;
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
1288
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1289 conv = pidgin_conv_window_get_active_conversation(win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1290
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1291 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
1292 }
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
1293
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
1294 static void
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1295 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
1296 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1297 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1298 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1299
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1300 conv = pidgin_conv_window_get_active_conversation(win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1301
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1302 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
1303 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1304
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
1305 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
1306 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
1307 {
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1308 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
1309 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
1310 }
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
1311
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 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
1313 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
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 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
1316
19556
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
1317 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
1318 "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
1319
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 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
1321 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
1322 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
1323 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
1324 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
1325 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
1326 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
1327 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
1328 }
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
1329 #if 0
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
1330 /* 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
1331 purple_conversation_set_ui_ops(conv, NULL);
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
1332 #else
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
1333 pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv);
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
1334 pidgin_conv_window_add_gtkconv(hidden_convwin, gtkconv);
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
1335 #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
1336 }
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
1337 }
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
1338
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
1339 static void
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1340 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
1341 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1342 PidginWindow *win = data;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1343
18797
0622a7f08dde smaller close buttons on tabs. I think this looks really good.
Sean Egan <seanegan@gmail.com>
parents: 18796
diff changeset
1344 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
1345 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1346
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1347 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1348 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
1349 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1350 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1351 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1352 gboolean logging;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1353
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1354 conv = pidgin_conv_window_get_active_conversation(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1355
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1356 if (conv == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1357 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1358
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1359 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
1360
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1361 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
1362 return;
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 (logging)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1365 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1366 /* 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
1367 purple_conversation_set_logging(conv, TRUE);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1368
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1369 purple_conversation_write(conv, NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1370 _("Logging 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
1371 conv->logs ? (PURPLE_MESSAGE_SYSTEM) :
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1372 (PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1373 time(NULL));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1374 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1375 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1376 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1377 purple_conversation_write(conv, NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1378 _("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
1379 conv->logs ? (PURPLE_MESSAGE_SYSTEM) :
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1380 (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
1381 time(NULL));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1382
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1383 /* 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
1384 purple_conversation_set_logging(conv, FALSE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1385 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1386 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1387
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1388 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1389 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
1390 {
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
1391 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
1392 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
1393 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1394
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1395 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1396 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
1397 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1398 PidginWindow *win = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1399 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1400 PidginConversation *gtkconv;
19980
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
1401 PurpleBlistNode *node;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1402
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1403 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
1404
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1405 if (!conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1406 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1407
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1408 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1409
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1410 gtkconv->make_sound =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1411 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
1412 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
1413 if (node)
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
1414 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
1415 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1416
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1417 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1418 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
1419 {
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
1420 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
1421 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
1422 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1423
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1424 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1425 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
1426 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1427 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1428 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1429 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1430 PurplePluginProtocolInfo *prpl_info = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1431 char *real_who;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1432
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1433 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1434 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1435
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1436 gc = purple_account_get_connection(account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1437 g_return_if_fail(gc != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1438
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1439 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
1440
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1441 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
1442 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
1443 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
1444 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1445 real_who = g_strdup(who);
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 if(!real_who)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1448 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1449
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
1450 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
1451
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1452 g_free(real_who);
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
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
1455 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
1456
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1457 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1458 ignore_cb(GtkWidget *w, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1459 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1460 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1461 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
1462 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
1463
3974d12a56ec Fix ignore in chats when using right-click on a nick in the conversation
Stu Tomlinson <stu@nosnilmot.com>
parents: 16273
diff changeset
1464 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
1465 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
1466
3974d12a56ec Fix ignore in chats when using right-click on a nick in the conversation
Stu Tomlinson <stu@nosnilmot.com>
parents: 16273
diff changeset
1467 if (name == NULL)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1468 return;
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 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
1471 purple_conv_chat_unignore(chat, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1472 else
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1473 purple_conv_chat_ignore(chat, name);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1474
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
1475 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
1476 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1477
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1478 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1479 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
1480 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1481 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
1482
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1483 chat_do_im(gtkconv, 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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1486 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1487 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
1488 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1489 PurpleConversation *conv = gtkconv->active_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1490 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
1491 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
1492
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1493 serv_send_file(gc, who, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1494 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1495
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1496 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1497 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
1498 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1499 char *who;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1500
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1501 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
1502
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1503 chat_do_info(gtkconv, who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1504 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1505
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1506 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1507 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
1508 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1509 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1510 PurplePluginProtocolInfo *prpl_info = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1511 PurpleConnection *gc;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1512 char *who;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1513
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1514 gc = purple_conversation_get_gc(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1515 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
1516
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1517 if (gc != NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1518 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
1519
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1520 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1521 * 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
1522 */
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 if (prpl_info->get_cb_away != 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 prpl_info->get_cb_away(gc,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1527 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
1528 }
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1531
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1532 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1533 menu_chat_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
1534 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1535 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1536 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1537 PurpleBuddy *b;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1538 char *name;
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 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1541 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
1542 b = purple_find_buddy(account, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1543
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1544 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
1545 pidgin_dialogs_remove_buddy(b);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1546 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
1547 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
1548
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1549 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
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 static GtkTextMark *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1553 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
1554 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1555 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
1556 char *tmp = g_strconcat("user:", who, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1557 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
1558
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1559 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1560 return mark;
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_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
1565 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1566 GtkTextMark *mark;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1567 const char *who;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1568
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1569 who = g_object_get_data(G_OBJECT(w), "user_data");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1570 mark = get_mark_for_user(gtkconv, who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1571
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1572 if (mark != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1573 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
1574 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1575 g_return_if_reached();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1576 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1577
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1578 static GtkWidget *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1579 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
1580 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1581 static GtkWidget *menu = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1582 PurplePluginProtocolInfo *prpl_info = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1583 PurpleConvChat *chat = PURPLE_CONV_CHAT(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1584 gboolean is_me = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1585 GtkWidget *button;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1586 PurpleBuddy *buddy = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1587
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1588 if (gc != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1589 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
1590
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1591 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1592 * 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
1593 * thus freeing-up the memory it occupied.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1594 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1595 if (menu)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1596 gtk_widget_destroy(menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1597
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1598 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
1599 is_me = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1600
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1601 menu = gtk_menu_new();
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 (!is_me) {
15560
442128853bdb toolbar/menu icons. reduce the imhtmltoolbar spacing. more gaimstock pruning
Sean Egan <seanegan@gmail.com>
parents: 15557
diff changeset
1604 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
1605 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
1606
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1607 if (gc == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1608 gtk_widget_set_sensitive(button, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1609
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1610 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
1611
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1612
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1613 if (prpl_info && prpl_info->send_file)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1614 {
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
1615 button = pidgin_new_item_from_stock(menu, _("Send File"),
16839
d6ccf170148e New Send File icon
Hylke Bons <hylkebons@gmail.com>
parents: 16809
diff changeset
1616 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
1617 PIDGIN_CONVERSATION(conv), 0, 0, 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 || prpl_info == NULL ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1620 !(!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
1621 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1622 gtk_widget_set_sensitive(button, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1623 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1624
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1625 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
1626 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1627
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1628
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1629 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
1630 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
1631 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
1632 else
15509
23ca11f8a8c4 stock to pidgin
Sean Egan <seanegan@gmail.com>
parents: 15508
diff changeset
1633 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
1634 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
1635
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1636 if (gc == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1637 gtk_widget_set_sensitive(button, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1638
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1639 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
1640 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1641
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1642 if (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
1643 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
1644 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
1645
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1646 if (gc == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1647 gtk_widget_set_sensitive(button, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1648
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1649 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
1650 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1651
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1652 if (prpl_info && prpl_info->get_cb_away) {
15509
23ca11f8a8c4 stock to pidgin
Sean Egan <seanegan@gmail.com>
parents: 15508
diff changeset
1653 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
1654 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
1655
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1656 if (gc == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1657 gtk_widget_set_sensitive(button, FALSE);
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 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
1660 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1661
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1662 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
1663 if ((buddy = purple_find_buddy(conv->account, who)) != NULL)
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
1664 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
1665 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
1666 else
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
1667 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
1668 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
1669
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1670 if (gc == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1671 gtk_widget_set_sensitive(button, FALSE);
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 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
1674 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1675
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
1676 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
1677 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
1678 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
1679 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
1680 gtk_widget_set_sensitive(button, FALSE);
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 if (buddy != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1683 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1684 if (purple_account_is_connected(conv->account))
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1685 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
1686 (PurpleBlistNode *)buddy);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1687 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
1688 gtk_widget_show_all(menu);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1691 return menu;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1694
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1695 static gint
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1696 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
1697 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1698 PurpleConversation *conv = gtkconv->active_conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1699 PidginChatPane *gtkchat;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1700 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1701 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1702 GtkTreeSelection *sel;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1703 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1704 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1705 GtkWidget *menu;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1706 gchar *who;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1707
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1708 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1709 gtkchat = gtkconv->u.chat;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1710 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1711 gc = account->gc;
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 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
1714
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1715 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
1716 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
1717 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1718
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1719 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
1720 menu = create_chat_menu (conv, who, gc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1721 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
1722 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
1723 0, GDK_CURRENT_TIME);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1724 g_free(who);
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 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1727 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1728
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1729
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1730 static gint
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1731 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
1732 PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1733 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1734 PurpleConversation *conv = gtkconv->active_conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1735 PidginChatPane *gtkchat;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1736 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1737 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1738 GtkTreePath *path;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1739 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1740 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1741 GtkTreeViewColumn *column;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1742 gchar *who;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1743 int x, y;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1744
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1745 gtkchat = gtkconv->u.chat;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1746 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1747 gc = account->gc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1748
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1749 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
1750
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1751 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
1752 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
1753
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1754 if (path == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1755 return FALSE;
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 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
1758 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
1759 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
1760 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
1761 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
1762
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1763 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
1764 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
1765
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1766 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
1767 chat_do_im(gtkconv, who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1768 } 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
1769 /* Move to user's anchor */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1770 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
1771
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1772 if(mark != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1773 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
1774 } 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
1775 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
1776 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
1777 event->button, event->time);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1778 }
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 g_free(who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1781 gtk_tree_path_free(path);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1782
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1783 return TRUE;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1786 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1787 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
1788 {
17141
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1789 PidginConversation *next_gtkconv = NULL, *most_active = NULL;
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1790 PidginUnseenState unseen_state = PIDGIN_UNSEEN_NONE;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1791 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1792 int initial, i, total, diff;
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 win = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1795 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
1796 gtkconv->tab_cont);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1797 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
1798 /* 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
1799 * 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
1800 * positive number.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1801 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1802 diff = (forward ? 1 : -1) + total;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1803
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1804 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
1805 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
1806 if (next_gtkconv->unseen_state > unseen_state) {
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1807 most_active = next_gtkconv;
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1808 unseen_state = most_active->unseen_state;
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1809 if(PIDGIN_UNSEEN_NICK == unseen_state) /* highest possible state */
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1810 break;
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1811 }
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1812 }
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1813
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1814 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
1815 i = (i + diff) % total;
17141
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1816 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
1817 }
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1818
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1819 if (most_active != NULL && most_active != gtkconv)
03866cefa848 Patch #1054 from resiak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17116
diff changeset
1820 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
1821 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1822
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1823 static gboolean
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1824 conv_keypress_common(PidginConversation *gtkconv, GdkEventKey *event)
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1825 {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1826 PidginWindow *win;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1827 PurpleConversation *conv;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1828 int curconv;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1829
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1830 conv = gtkconv->active_conv;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1831 win = gtkconv->win;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1832 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
1833
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1834 /* If CTRL was held down... */
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1835 if (event->state & GDK_CONTROL_MASK) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1836 switch (event->keyval) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1837 case GDK_Page_Down:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1838 case ']':
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1839 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
1840 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
1841 else
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1842 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
1843 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1844 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1845
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1846 case GDK_Page_Up:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1847 case '[':
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1848 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
1849 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
1850 else
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1851 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
1852 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1853 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1854
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1855 case GDK_Tab:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1856 case GDK_ISO_Left_Tab:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1857 if (event->state & GDK_SHIFT_MASK) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1858 move_to_next_unread_tab(gtkconv, FALSE);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1859 } else {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1860 move_to_next_unread_tab(gtkconv, TRUE);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1861 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1862
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1863 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1864 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1865
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1866 case GDK_comma:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1867 gtk_notebook_reorder_child(GTK_NOTEBOOK(win->notebook),
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1868 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
1869 curconv - 1);
20190
da6a1320d3e1 applied changes from f4700a52b60d8473e9671ceabfec7772211fe424
Richard Laager <rlaager@wiktel.com>
parents: 20183
diff changeset
1870 return TRUE;
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1871 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1872
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1873 case GDK_period:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1874 gtk_notebook_reorder_child(GTK_NOTEBOOK(win->notebook),
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1875 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
1876 #if GTK_CHECK_VERSION(2,2,0)
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1877 (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
1878 #else
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1879 (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
1880 #endif
20190
da6a1320d3e1 applied changes from f4700a52b60d8473e9671ceabfec7772211fe424
Richard Laager <rlaager@wiktel.com>
parents: 20183
diff changeset
1881 return TRUE;
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1882 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1883
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1884 } /* End of switch */
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
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1887 /* If ALT (or whatever) was held down... */
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1888 else if (event->state & GDK_MOD1_MASK)
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1889 {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1890 if (event->keyval > '0' && event->keyval <= '9')
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1891 {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1892 guint switchto = event->keyval - '1';
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1893 if (switchto < pidgin_conv_window_get_gtkconv_count(win))
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1894 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), switchto);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1895
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1896 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1897 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1898 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1899
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1900 /* If neither CTRL nor ALT were held down... */
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1901 else
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1902 {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1903 switch (event->keyval) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1904 case GDK_F2:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1905 if (gtk_widget_is_focus(GTK_WIDGET(win->notebook))) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1906 infopane_entry_activate(gtkconv);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1907 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1908 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1909 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1910 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1911 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1912 return FALSE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1913 }
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 static gboolean
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1916 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
1917 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1918 PidginWindow *win;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1919 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1920 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1921
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
1922 gtkconv = (PidginConversation *)data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1923 conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1924 win = gtkconv->win;
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1925
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1926 if (conv_keypress_common(gtkconv, event))
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
1927 return TRUE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1928
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1929 /* If CTRL was held down... */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1930 if (event->state & GDK_CONTROL_MASK) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1931 switch (event->keyval) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1932 case GDK_Up:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1933 if (!gtkconv->send_history)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1934 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1935
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
1936 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
1937 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
1938
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1939 if (!gtkconv->send_history->prev) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1940 GtkTextIter start, end;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1941
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1942 g_free(gtkconv->send_history->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1943
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1944 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
1945 &start);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1946 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
1947
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1948 gtkconv->send_history->data =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1949 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
1950 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1951
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1952 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
1953 GObject *object;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1954 GtkTextIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1955 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
1956
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1957 gtkconv->send_history = gtkconv->send_history->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1958
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1959 /* 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
1960 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
1961 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
1962 NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1963 /* Clear the formatting. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1964 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
1965 /* Unblock the signal. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1966 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
1967 NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1968 g_object_unref(object);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1969
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1970 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1971 gtk_imhtml_append_text_with_images(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1972 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
1973 0, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1974 /* 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
1975 * cursor gets picked up. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1976 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
1977 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
1978 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1979
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1980 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1981 break;
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 case GDK_Down:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1984 if (!gtkconv->send_history)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1985 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1986
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
1987 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
1988 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
1989
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1990 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
1991 GObject *object;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1992 GtkTextIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1993 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
1994
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1995 gtkconv->send_history = gtkconv->send_history->prev;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1996
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1997 /* 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
1998 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
1999 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
2000 NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2001 /* Clear the formatting. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2002 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
2003 /* Unblock the signal. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2004 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
2005 NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2006 g_object_unref(object);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2007
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2008 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2009 gtk_imhtml_append_text_with_images(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2010 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
2011 0, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2012 /* 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
2013 * cursor gets picked up. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2014 if (*(char *)gtkconv->send_history->data) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2015 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
2016 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
2017 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2018 /* Restore the default formatting */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2019 default_formatize(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2020 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2021 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2022
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2023 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2024 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2025 } /* End of switch */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2026 }
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 /* If ALT (or whatever) was held down... */
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2029 else if (event->state & GDK_MOD1_MASK) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2030
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2031 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2032
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2033 /* If neither CTRL nor ALT were held down... */
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2034 else {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2035 switch (event->keyval) {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2036 case GDK_Tab:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2037 if (gtkconv->entry != entry)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2038 break;
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2039 return tab_complete(conv);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2040 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2041
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2042 case GDK_Page_Up:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2043 gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml));
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2044 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2045 break;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2046
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2047 case GDK_Page_Down:
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2048 gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml));
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2049 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2050 break;
15374
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 FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2055 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2056
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 * NOTE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2059 * 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
2060 * 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
2061 * 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
2062 * 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
2063 * 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
2064 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2065 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2066 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
2067 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2068 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
2069 /* Right single click */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2070 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
2071
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2072 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2073 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2074
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2075 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2076 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2077
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2078 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2079 * 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
2080 * 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
2081 * 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
2082 * 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
2083 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2084 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2085 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
2086 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2087 PidginConversation *gtkconv = data;
15374
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 /* 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
2090 if ((event->state & GDK_CONTROL_MASK) ||
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2091 (event->keyval == GDK_F6) ||
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2092 (event->keyval == GDK_F10) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2093 (event->keyval == GDK_Shift_L) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2094 (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
2095 (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
2096 (event->keyval == GDK_Control_R) ||
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2097 (event->keyval == GDK_Escape) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2098 (event->keyval == GDK_Up) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2099 (event->keyval == GDK_Down) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2100 (event->keyval == GDK_Left) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2101 (event->keyval == GDK_Right) ||
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2102 (event->keyval == GDK_Page_Up) ||
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2103 (event->keyval == GDK_Page_Down) ||
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2104 (event->keyval == GDK_Home) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2105 (event->keyval == GDK_End) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2106 (event->keyval == GDK_Tab) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2107 (event->keyval == GDK_ISO_Left_Tab))
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2108 {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2109 if (event->type == GDK_KEY_PRESS)
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2110 return conv_keypress_common(gtkconv, event);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2111 return FALSE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
2112 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2113
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2114 if (event->type == GDK_KEY_RELEASE)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2115 gtk_widget_grab_focus(gtkconv->entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2116
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2117 gtk_widget_event(gtkconv->entry, (GdkEvent *)event);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2118
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2119 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2120 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2121
17846
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
2122 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
2123 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
2124
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2125 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2126 pidgin_conv_switch_active_conversation(PurpleConversation *conv)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2127 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2128 PidginConversation *gtkconv;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2129 PurpleConversation *old_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2130 GtkIMHtml *entry;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2131 const char *protocol_name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2132
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2133 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2134
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2135 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2136 old_conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2137
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2138 if (old_conv == conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2139 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2140
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2141 purple_conversation_close_logs(old_conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2142 gtkconv->active_conv = conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2143
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2144 purple_conversation_set_logging(conv,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2145 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
2146
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2147 entry = GTK_IMHTML(gtkconv->entry);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2148 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
2149 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
2150 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
2151
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2152 if (!(conv->features & PURPLE_CONNECTION_HTML))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2153 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
2154 else if (conv->features & PURPLE_CONNECTION_FORMATTING_WBFO &&
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2155 !(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
2156 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2157 /* 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
2158 * 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
2159 * 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
2160 * 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
2161 * 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
2162
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2163 gboolean bold;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2164 gboolean italic;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2165 gboolean underline;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2166 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
2167 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
2168 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
2169 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
2170 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
2171 gboolean bold2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2172 gboolean italic2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2173 gboolean underline2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2174
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2175 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
2176
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2177 /* Clear existing formatting */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2178 gtk_imhtml_clear_formatting(entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2179
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2180 /* Apply saved formatting to the whole buffer. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2181
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2182 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
2183
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2184 if (bold != bold2)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2185 gtk_imhtml_toggle_bold(entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2186
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2187 if (italic != italic2)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2188 gtk_imhtml_toggle_italic(entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2189
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2190 if (underline != underline2)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2191 gtk_imhtml_toggle_underline(entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2192
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2193 gtk_imhtml_toggle_fontface(entry, fontface);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2194
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2195 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
2196 gtk_imhtml_font_set_size(entry, fontsize);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2197
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2198 gtk_imhtml_toggle_forecolor(entry, forecolor);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2199
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2200 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
2201 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2202 gtk_imhtml_toggle_backcolor(entry, backcolor);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2203 gtk_imhtml_toggle_background(entry, background);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2204 }
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 g_free(fontface);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2207 g_free(forecolor);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2208 g_free(backcolor);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2209 g_free(background);
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 else
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 /* 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
2214 * 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
2215 * 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
2216 * 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
2217 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
2218 (conv->features & PURPLE_CONNECTION_FORMATTING_WBFO));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2219 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2220
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2221 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
2222
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2223 gray_stuff_out(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2224 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
2225 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
2226 regenerate_options_items(gtkconv->win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2227
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2228 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
2229 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
2230 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2231
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2232 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2233 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
2234 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2235 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
2236 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
2237 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2238
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2239 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
2240 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2241
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2242 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
2243 pidgin_conv_switch_active_conversation(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2244 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2245
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2246 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2247 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2248 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
2249 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2250 PidginConversation *gtkconv = (PidginConversation *)user_data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2251 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2252
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2253 g_return_if_fail(gtkconv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2254
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2255 conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2256
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
2257 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
2258 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2259
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2260 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
2261 gtk_text_iter_is_end(position)));
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2264 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2265 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
2266 GtkTextIter *end_pos, gpointer user_data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2267 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2268 PidginConversation *gtkconv = (PidginConversation *)user_data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2269 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2270 PurpleConvIm *im;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2271
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2272 g_return_if_fail(gtkconv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2273
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2274 conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2275
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
2276 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
2277 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2278
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2279 im = PURPLE_CONV_IM(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2280
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2281 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
2282
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2283 /* 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
2284 purple_conv_im_stop_send_typed_timeout(im);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2285
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2286 serv_send_typing(purple_conversation_get_gc(conv),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2287 purple_conversation_get_name(conv),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2288 PURPLE_NOT_TYPING);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2289 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2290 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2291 /* 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
2292 got_typing_keypress(gtkconv, FALSE);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2296 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2297 * A bunch of buddy icon functions
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2298 **************************************************************************/
15724
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2299
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2300 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
2301 {
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2302 GList *l = NULL;
17397
012aaa301a30 Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17392
diff changeset
2303 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
2304 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
2305 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
2306 l = g_hash_table_lookup(prpl_lists, prplname);
15724
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2307 if (l)
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2308 return l;
17397
012aaa301a30 Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17392
diff changeset
2309
012aaa301a30 Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17392
diff changeset
2310 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
2311 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
2312 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
2313
012aaa301a30 Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17392
diff changeset
2314 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
2315 return l;
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2316 }
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2317
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2318 static GList *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2319 pidgin_conv_get_tab_icons(PurpleConversation *conv)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2320 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2321 PurpleAccount *account = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2322 const char *name = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2323
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2324 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
2325
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2326 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2327 name = purple_conversation_get_name(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2328
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2329 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
2330 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
2331
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2332 /* Use the buddy icon, if possible */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2333 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
2334 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
2335 if (b != NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2336 PurplePresence *p;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2337 p = purple_buddy_get_presence(b);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2338 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
2339 return away_list;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2340 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
2341 return busy_list;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2342 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
2343 return xa_list;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2344 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
2345 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
2346 else
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2347 return available_list;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2348 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2349 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2350
15724
72d66bc51c43 multi-sized prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15723
diff changeset
2351 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
2352 }
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2353
19899
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2354 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
2355 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
2356 {
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2357 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
2358 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
2359 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
2360 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
2361 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
2362
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2363 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
2364 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
2365
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2366 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
2367 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
2368
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2369 /* 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
2370 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
2371 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
2372 if (b != NULL) {
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2373 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
2374 /* 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
2375 * 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
2376 * 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
2377 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
2378 ops->update(NULL, (PurpleBlistNode*)b);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2379
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2380 /* 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
2381 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
2382 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
2383 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
2384 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
2385 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
2386 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
2387 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
2388 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
2389 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
2390 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
2391 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
2392 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
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 }
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2395
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2396 /* 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
2397 if (status == NULL) {
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2398 GtkIconSize size = gtk_icon_size_from_name(icon_size);
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2399 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
2400 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
2401 size, "GtkWidget");
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2402 } 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
2403 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
2404 size, "GtkWidget");
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2405 }
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2406 }
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2407 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
2408 }
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2409
19899
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2410 GdkPixbuf *
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2411 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
2412 {
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2413 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
2414 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
2415 }
25f4be036a16 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19898
diff changeset
2416
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2417
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2418 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2419 update_tab_icon(PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2420 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2421 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2422 PidginWindow *win;
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2423 PurpleBuddy *b;
16315
ee4ce3c4186f Fix #248 (Control shouldn't steal focus from scrollback)
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16286
diff changeset
2424 GList *l;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2425 GdkPixbuf *status = NULL;
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2426 GdkPixbuf *infopane_status = NULL;
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2427 GdkPixbuf *emblem = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2428
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2429 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2430
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2431 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2432 win = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2433 if (conv != gtkconv->active_conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2434 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2435
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2436
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
2437 status = pidgin_conv_get_tab_icon(conv, TRUE);
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2438 infopane_status = pidgin_conv_get_tab_icon(conv, FALSE);
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2439
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2440 b = purple_find_buddy(conv->account, conv->name);
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2441 if (b)
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2442 emblem = pidgin_blist_get_emblem((PurpleBlistNode*)b);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2443
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2444 g_return_if_fail(status != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2445
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2446 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
2447 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
2448
18214
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2449 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
2450 &(gtkconv->infopane_iter),
19293
758b71dcd354 Small tab icons
Sean Egan <seanegan@gmail.com>
parents: 19291
diff changeset
2451 CONV_ICON_COLUMN, infopane_status, -1);
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2452
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2453 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
2454 &(gtkconv->infopane_iter),
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2455 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
2456 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
2457 g_object_unref(emblem);
18591
10ea90700776 Add emblem to infopane. Fixes #79
Sean Egan <seanegan@gmail.com>
parents: 18590
diff changeset
2458
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
2459 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
2460 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
2461 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
2462 &(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
2463 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
2464 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
2465 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
2466 }
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
2467
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
2468 /* 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
2469 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
2470
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2471 if (status != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2472 g_object_unref(status);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2473
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2474 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
2475 (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
2476 gtkconv->u.im->anim == NULL))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2477 {
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2478 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
2479
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
2480 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
2481 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2482 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2483
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2484 /* 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
2485 * 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
2486 * 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
2487 * 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
2488 * gets set back to FALSE
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2489 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2490 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
2491 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2492 PidginConversation *gtkconv = (PidginConversation *)data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2493 gtkconv->auto_resize = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2494 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2495 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2496
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2497 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2498 redraw_icon(gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2499 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2500 PidginConversation *gtkconv = (PidginConversation *)data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2501 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2502 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2503 PurplePluginProtocolInfo *prpl_info = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2504
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2505 GdkPixbuf *buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2506 GdkPixbuf *scale;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2507 gint delay;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2508 int scale_width, scale_height;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2509
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2510 gtkconv = PIDGIN_CONVERSATION(conv);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2511 account = purple_conversation_get_account(conv);
16604
598b66923c81 hopefully fix 236
Nathan Walp <nwalp@pidgin.im>
parents: 16577
diff changeset
2512
598b66923c81 hopefully fix 236
Nathan Walp <nwalp@pidgin.im>
parents: 16577
diff changeset
2513 if(account && account->gc) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2514 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(account->gc->prpl);
16604
598b66923c81 hopefully fix 236
Nathan Walp <nwalp@pidgin.im>
parents: 16577
diff changeset
2515 } else {
598b66923c81 hopefully fix 236
Nathan Walp <nwalp@pidgin.im>
parents: 16577
diff changeset
2516 gtkconv->u.im->icon_timer = 0;
598b66923c81 hopefully fix 236
Nathan Walp <nwalp@pidgin.im>
parents: 16577
diff changeset
2517 return FALSE;
598b66923c81 hopefully fix 236
Nathan Walp <nwalp@pidgin.im>
parents: 16577
diff changeset
2518 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2519
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2520 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
2521 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
2522
18214
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2523 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
2524 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
2525 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
2526 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
2527 } 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
2528 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
2529 scale_height = 32;
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2530 } else {
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2531 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
2532 scale_width = 32;
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2533 }
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2534
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
2535 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
2536 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
2537 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
2538 pidgin_gdk_pixbuf_make_round(scale);
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 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
2541 g_object_unref(G_OBJECT(scale));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2542 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
2543
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2544 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
2545
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2546 if (delay < 100)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2547 delay = 100;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2548
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2549 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
2550
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2551 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2552 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2553
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2554 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2555 start_anim(GtkObject *obj, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2556 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2557 int delay;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2558
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2559 if (gtkconv->u.im->anim == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2560 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2561
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2562 if (gtkconv->u.im->icon_timer != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2563 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2564
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2565 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
2566 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2567
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2568 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
2569
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2570 if (delay < 100)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2571 delay = 100;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2572
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2573 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
2574 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2575
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2576 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2577 remove_icon(GtkWidget *widget, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2578 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2579 PurpleConversation *conv = gtkconv->active_conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2580 PidginWindow *gtkwin;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2581
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2582 g_return_if_fail(conv != NULL);
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 if (gtkconv->u.im->icon_container != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2585 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
2586
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2587 if (gtkconv->u.im->anim != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2588 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
2589
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2590 if (gtkconv->u.im->icon_timer != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2591 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
2592
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2593 if (gtkconv->u.im->iter != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2594 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
2595
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2596 gtkconv->u.im->icon_timer = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2597 gtkconv->u.im->icon = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2598 gtkconv->u.im->anim = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2599 gtkconv->u.im->iter = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2600 gtkconv->u.im->icon_container = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2601 gtkconv->u.im->show_icon = FALSE;
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 gtkwin = gtkconv->win;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2606 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2607 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
2608 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2609 PidginConversation *gtkconv = (PidginConversation *)user_data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2610 PurpleConversation *conv = gtkconv->active_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2611 FILE *fp;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2612 PurpleBuddyIcon *icon;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2613 const void *data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2614 size_t len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2615
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2616 if ((fp = g_fopen(filename, "wb")) == NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2617 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
2618 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2619 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2620
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2621 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
2622 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
2623
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2624 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
2625 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
2626 fclose(fp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2627 g_unlink(filename);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2628 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2629 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2630 fclose(fp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2631 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2632
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2633 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2634 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
2635 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2636 if (filename) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2637 PidginConversation *gtkconv = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2638 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2639 PurpleAccount *account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2640 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
2641 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2642 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2643
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2644 static void
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2645 set_custom_icon_cb(GtkWidget *widget, PidginConversation *gtkconv)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2646 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2647 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
2648 custom_icon_sel_cb, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2649 gtk_widget_show_all(win);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2652 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2653 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
2654 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2655 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2656 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2657
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2658 conv = gtkconv->active_conv;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2659 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2660 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
2661 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2662
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2663 static void
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2664 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
2665 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2666 PurpleConversation *conv = gtkconv->active_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2667 const gchar *ext;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2668 gchar *buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2669
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2670 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2671
16375
391a79778f89 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@wiktel.com>
parents: 16373
diff changeset
2672 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
2673
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2674 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
2675
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2676 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
2677 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
2678 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
2679 gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2680
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2681 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2682 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2683
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2684 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2685 stop_anim(GtkObject *obj, PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2686 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2687 if (gtkconv->u.im->icon_timer != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2688 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
2689
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2690 gtkconv->u.im->icon_timer = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2691 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2692
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2693
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2694 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2695 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
2696 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2697 gtkconv->u.im->animate =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2698 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
2699
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2700 if (gtkconv->u.im->animate)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2701 start_anim(NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2702 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2703 stop_anim(NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2704 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2705
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2706 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2707 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
2708 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2709 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
2710 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
2711 PurpleBuddy *buddy;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2712
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2713 if (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
2714 return FALSE;
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 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2717 * 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
2718 * thus freeing-up the memory it occupied.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2719 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2720 if (menu != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2721 gtk_widget_destroy(menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2722
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2723 menu = gtk_menu_new();
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 if (gtkconv->u.im->anim &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2726 !(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
2727 {
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
2728 pidgin_new_check_item(menu, _("Animate"),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2729 G_CALLBACK(toggle_icon_animate_cb), gtkconv,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2730 gtkconv->u.im->icon_timer);
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
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
2733 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
2734 gtkconv, 0, 0, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2735
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
2736 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
2737 G_CALLBACK(icon_menu_save_cb), gtkconv,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2738 0, 0, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2739
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
2740 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
2741 G_CALLBACK(set_custom_icon_cb), gtkconv,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2742 0, 0, NULL);
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 /* 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
2745 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
2746 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
2747 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
2748 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
2749 {
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
2750 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
2751 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
2752 {
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
2753 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
2754 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
2755 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
2756 }
15374
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2759 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
2760
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2761 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2762 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2763
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2764 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2765 * 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
2766 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2767 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2768 pidgin_conv_present_conversation(PurpleConversation *conv)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2769 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2770 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
2771 GdkModifierType state;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2772
19898
be8bb6f98c01 Get rid of hidden_convwin.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
2773 if (gtkconv == NULL) {
be8bb6f98c01 Get rid of hidden_convwin.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
2774 pidgin_conv_attach_to_conversation(conv);
be8bb6f98c01 Get rid of hidden_convwin.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
2775 gtkconv = PIDGIN_CONVERSATION(conv);
21702
cf579f61b887 merge of '2dee17b0fb69284b66649d32e66b473471970a43'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21701 19905
diff changeset
2776 } else if (gtkconv->win == hidden_convwin) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2777 pidgin_conv_window_remove_gtkconv(hidden_convwin, gtkconv);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
2778 pidgin_conv_placement_place(gtkconv);
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
2779 }
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
2780
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
2781 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
2782 /* 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
2783 * 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
2784 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
2785 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
2786 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
2787 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2788
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2789 GList *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2790 pidgin_conversations_find_unseen_list(PurpleConversationType type,
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
2791 PidginUnseenState min_state,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2792 gboolean hidden_only,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2793 guint max_count)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2794 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
2795 GList *l;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2796 GList *r = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2797 guint c = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2798
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2799 if (type == PURPLE_CONV_TYPE_IM) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2800 l = purple_get_ims();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2801 } else if (type == PURPLE_CONV_TYPE_CHAT) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2802 l = purple_get_chats();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2803 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2804 l = purple_get_conversations();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2805 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2806
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2807 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
2808 PurpleConversation *conv = (PurpleConversation*)l->data;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2809 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2810
19417
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
2811 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
2812 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2813
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2814 if (gtkconv->unseen_state >= min_state
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2815 && (!hidden_only ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2816 (hidden_only && gtkconv->win == hidden_convwin))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2817
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2818 r = g_list_prepend(r, conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2819 c++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2820 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2821 }
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 return r;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2824 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2825
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2826 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2827 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
2828 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2829 g_return_if_fail(conv != NULL);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
2830 pidgin_conv_present_conversation(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2831 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2832
19584
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2833 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
2834 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
2835 {
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2836 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
2837 /* 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
2838 * '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
2839 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
2840 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
2841 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
2842 }
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2843 }
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2844
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2845 guint
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2846 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
2847 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2848 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2849 guint ret=0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2850
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2851 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
2852 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
2853
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2854 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
2855 PurpleConversation *conv = (PurpleConversation*)l->data;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2856 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
15374
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 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
2859 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
2860 GtkWidget *item;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2861 gchar *text = g_strdup_printf("%s (%d)",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2862 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
2863 gtkconv->unseen_count);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2864
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2865 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
2866 g_object_unref(pbuf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2867
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2868 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
2869 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
2870 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
2871 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
2872 g_free(text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2873 ret++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2874 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2875
19584
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2876 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
2877 /* 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
2878 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
2879 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
2880
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2881 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
2882
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2883 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
2884 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
2885 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
2886 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
2887 }
f69e7fb8a449 pidgin_conversations_fill_menu now also adds a separator and a 'Show
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19559
diff changeset
2888
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2889 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2890 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2891
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2892 PidginWindow *
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
2893 pidgin_conv_get_window(PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2894 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2895 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
2896 return gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2897 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2898
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2899 static GtkItemFactoryEntry menu_items[] =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2900 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2901 /* Conversation menu */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2902 { N_("/_Conversation"), NULL, NULL, 0, "<Branch>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2903
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2904 { 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
2905 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
2906
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2907 { "/Conversation/sep0", NULL, NULL, 0, "<Separator>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2908
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2909 { 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
2910 "<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
2911 { 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
2912 { 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
2913 "<StockItem>", GTK_STOCK_SAVE_AS },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2914 { 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
2915
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2916 { "/Conversation/sep1", NULL, NULL, 0, "<Separator>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2917
16839
d6ccf170148e New Send File icon
Hylke Bons <hylkebons@gmail.com>
parents: 16809
diff changeset
2918 { 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
2919 { 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
2920 0, "<Item>", NULL },
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2921 { 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
2922 "<StockItem>", PIDGIN_STOCK_TOOLBAR_USER_INFO },
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2923 { 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
2924 "<Item>", NULL },
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2925 { 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
2926
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2927 { "/Conversation/sep2", NULL, NULL, 0, "<Separator>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2928
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2929 { 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
2930 "<Item>", NULL },
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2931 { 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
2932 "<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
2933 { 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
2934 "<StockItem>", PIDGIN_STOCK_TOOLBAR_UNBLOCK },
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2935 { 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
2936 "<StockItem>", GTK_STOCK_ADD },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2937 { 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
2938 "<StockItem>", GTK_STOCK_REMOVE },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2939
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2940 { "/Conversation/sep3", NULL, NULL, 0, "<Separator>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2941
17776
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
2942 { 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
2943 "<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
2944 { 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
2945 "<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
2946
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
2947 { "/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
2948
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
2949
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2950 { 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
2951 "<StockItem>", GTK_STOCK_CLOSE },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2952
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2953 /* Options */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2954 { N_("/_Options"), NULL, NULL, 0, "<Branch>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2955 { 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
2956 { 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
2957 { "/Options/sep0", NULL, NULL, 0, "<Separator>", NULL },
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2958 { 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
2959 { 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
2960 };
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 static const int menu_item_count =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2963 sizeof(menu_items) / sizeof(*menu_items);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2964
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2965 static const char *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2966 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
2967 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2968 return _(path);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2969 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2970
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2971 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
2972 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
2973 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2974 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2975 PidginWindow *win = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2976 const char *method = value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2977
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2978 if (!strcmp(method, "none"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2979 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2980 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
2981 FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2982 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
2983 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2984 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2985 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
2986 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
2987
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2988 if (gtkconv != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2989 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
2990 gtkconv->make_sound);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2991 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
2992
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2993 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2994 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2995
18658
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
2996 /* 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
2997 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
2998 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
2999 {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3000 GList *list;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3001 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
3002 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
3003 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
3004 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
3005 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
3006
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3007 conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3008
17846
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3009 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
3010 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
3011
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3012 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
3013 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
3014 }
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3015
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3016 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
3017 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
3018 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
3019 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
3020 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
3021 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
3022 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
3023 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
3024 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
3025 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
3026 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
3027 }
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3028 } 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
3029 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
3030 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
3031
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
3032 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
3033
17846
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3034 /* 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
3035 * 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
3036 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
3037 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
3038 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
3039 }
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3040
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3041 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
3042 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
3043 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
3044 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
3045 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
3046 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
3047 }
2f21e46758a3 This makes Conversation->More work for non-buddies and chats not on your
Stu Tomlinson <stu@nosnilmot.com>
parents: 17820
diff changeset
3048 }
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
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
3051 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
3052 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
3053 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
3054 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
3055
18658
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3056 /* 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
3057 if (all) {
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
3058 if (buddy)
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
3059 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
3060 else if (chat) {
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
3061 /* XXX: */
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
3062 }
18658
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3063 } 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
3064 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
3065 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
3066 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
3067 }
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3068
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3069 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
3070 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
3071 } else {
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3072 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
3073 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
3074 }
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3075 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
3076 }
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3077
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3078 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
3079 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
3080 {
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3081 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
3082 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
3083 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
3084
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3085 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
3086 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
3087
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3088 /* Remove the previous entries */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3089 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
3090 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3091 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
3092 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
3093 gtk_widget_destroy(w);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3094 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3095
18658
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
3096 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
3097 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3098 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
3099 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
3100 gtk_widget_set_sensitive(item, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3101 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3102
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3103 gtk_widget_show_all(menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3104 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3105
17392
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3106 static void
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3107 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
3108 {
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3109 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
3110 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
3111 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
3112 }
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3113
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3114 static void
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3115 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
3116 {
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3117 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
3118 GtkWidget *menu;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3119 GList *list;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3120 PidginConversation *gtkconv;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3121 PurpleConversation *conv;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3122 GtkWidget *item;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3123
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
3124 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
3125 return;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3126
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3127 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
3128 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
3129 return;
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3130
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3131 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
3132 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
3133
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3134 /* 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
3135 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
3136 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
3137 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
3138 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
3139 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
3140 }
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3141
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3142 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
3143
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3144 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
3145 if (list) {
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3146 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
3147 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
3148 }
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3149
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3150 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
3151 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
3152 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
3153 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
3154 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
3155 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
3156 }
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3157 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
3158 }
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
3159
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3160 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
3161 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3162 PidginWindow *win = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3163 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
3164 regenerate_plugins_items(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3165
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3166 /* 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
3167 * 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
3168 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
3169 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
3170 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3171
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3172 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3173 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
3174 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3175 /* 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
3176 * the 'Conversation' menu pops up. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3177 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
3178 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
3179 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
3180 G_CALLBACK(focus_out_from_menubar), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3181 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3182
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3183 static GtkWidget *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3184 setup_menubar(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3185 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3186 GtkAccelGroup *accel_group;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3187 const char *method;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3188 GtkWidget *menuitem;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3189
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3190 accel_group = gtk_accel_group_new ();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3191 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
3192 g_object_unref(accel_group);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3193
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3194 win->menu.item_factory =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3195 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
3196
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3197 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
3198 (GtkTranslateFunc)item_factory_translate_func,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3199 NULL, NULL);
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 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
3202 menu_items, win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3203 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
3204 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
3205
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3206 /* 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
3207 * 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
3208 * conversation is created. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3209 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
3210 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
3211
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3212 win->menu.menubar =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3213 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
3214
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3215 win->menu.view_log =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3216 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
3217 N_("/Conversation/View Log"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3218
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3219 /* --- */
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 win->menu.send_file =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3222 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
3223 N_("/Conversation/Send File..."));
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 win->menu.add_pounce =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3226 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
3227 N_("/Conversation/Add Buddy Pounce..."));
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 /* --- */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3230
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3231 win->menu.get_info =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3232 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
3233 N_("/Conversation/Get Info"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3234
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3235 win->menu.invite =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3236 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
3237 N_("/Conversation/Invite..."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3238
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3239 /* --- */
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 win->menu.alias =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3242 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
3243 N_("/Conversation/Alias..."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3244
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3245 win->menu.block =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3246 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
3247 N_("/Conversation/Block..."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3248
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
3249 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
3250 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
3251 N_("/Conversation/Unblock..."));
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
3252
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3253 win->menu.add =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3254 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
3255 N_("/Conversation/Add..."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3256
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3257 win->menu.remove =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3258 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
3259 N_("/Conversation/Remove..."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3260
17776
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3261 /* --- */
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3262
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3263 win->menu.insert_link =
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3264 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
3265 N_("/Conversation/Insert Link..."));
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3266
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3267 win->menu.insert_image =
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3268 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
3269 N_("/Conversation/Insert Image..."));
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3270
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3271 /* --- */
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
3272
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3273 win->menu.logging =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3274 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
3275 N_("/Options/Enable Logging"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3276 win->menu.sounds =
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_("/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
3279 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
3280 if (method != NULL && !strcmp(method, "none"))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3281 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3282 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
3283 FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3284 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
3285 }
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
3286 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
3287 sound_method_pref_changed_cb, win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3288
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3289 win->menu.show_formatting_toolbar =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3290 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
3291 N_("/Options/Show Formatting Toolbars"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3292 win->menu.show_timestamps =
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_("/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
3295 win->menu.show_icon = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3296
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3297 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
3298 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
3299 win->menu.tray);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3300 gtk_widget_show(win->menu.tray);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3301
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3302 gtk_widget_show(win->menu.menubar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3303
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3304 return win->menu.menubar;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3305 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3306
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3307
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3308 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3309 * Utility functions
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3310 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3311
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3312 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3313 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
3314 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3315 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3316 PurpleConvIm *im;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3317
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3318 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3319 * 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
3320 * send PURPLE_TYPED any time soon.
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3321 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3322
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3323 im = PURPLE_CONV_IM(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3324
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3325 purple_conv_im_stop_send_typed_timeout(im);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3326 purple_conv_im_start_send_typed_timeout(im);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3327
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3328 /* 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
3329 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
3330 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
3331 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3332 unsigned int timeout;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3333 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
3334 purple_conversation_get_name(conv),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3335 PURPLE_TYPING);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3336 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
3337 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3338 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3339
15725
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3340 static gboolean
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3341 typing_animation(gpointer data) {
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3342 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
3343 PidginWindow *gtkwin = gtkconv->win;
15725
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3344 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
3345
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
3346 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
3347 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
3348 }
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
3349
15725
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3350 switch (rand() % 5) {
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3351 case 0:
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3352 stock_id = PIDGIN_STOCK_ANIMATION_TYPING0;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3353 break;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3354 case 1:
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3355 stock_id = PIDGIN_STOCK_ANIMATION_TYPING1;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3356 break;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3357 case 2:
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3358 stock_id = PIDGIN_STOCK_ANIMATION_TYPING2;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3359 break;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3360 case 3:
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3361 stock_id = PIDGIN_STOCK_ANIMATION_TYPING3;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3362 break;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3363 case 4:
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3364 stock_id = PIDGIN_STOCK_ANIMATION_TYPING4;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3365 break;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3366 }
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3367 if (gtkwin->menu.typing_icon == NULL) {
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3368 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
3369 pidgin_menu_tray_append(PIDGIN_MENU_TRAY(gtkwin->menu.tray),
15725
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3370 gtkwin->menu.typing_icon,
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3371 _("User is typing..."));
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3372 } else {
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3373 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
3374 }
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3375 gtk_widget_show(gtkwin->menu.typing_icon);
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3376 return TRUE;
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3377 }
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3378
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3379 static void
21875
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3380 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
3381 {
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3382 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
3383 GtkTextMark *stmark, *enmark;
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3384
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3385 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
3386 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
3387 if (stmark && enmark) {
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3388 GtkTextIter start, end;
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3389 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
3390 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
3391 gtk_text_buffer_delete_mark(buffer, stmark);
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3392 gtk_text_buffer_delete_mark(buffer, enmark);
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3393 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
3394 } 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
3395 message = NULL;
21875
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3396
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3397 if (message) {
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3398 GtkTextIter iter;
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3399 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
3400 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
3401 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
3402 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
3403 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
3404 }
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3405 }
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3406
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3407 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3408 update_typing_icon(PidginConversation *gtkconv)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3409 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3410 PidginWindow *gtkwin;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3411 PurpleConvIm *im = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3412 PurpleConversation *conv = gtkconv->active_conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3413 char *stock_id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3414 const char *tooltip;
21875
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
3415 char *message = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3416
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3417 gtkwin = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3418
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3419 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
3420 im = PURPLE_CONV_IM(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3421
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3422 if (gtkwin->menu.typing_icon) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3423 gtk_widget_hide(gtkwin->menu.typing_icon);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3424 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3425
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
3426 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
3427 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
3428
99bf55ec6ca4 Fix an invalid read that occurs because we were accessing IM data when the
Richard Laager <rlaager@wiktel.com>
parents: 16483
diff changeset
3429 if (purple_conv_im_get_typing_state(im) == PURPLE_NOT_TYPING) {
17002
af4181dde6fa fix the typing animation so it doesn't stop animating once a conversation
Nathan Walp <nwalp@pidgin.im>
parents: 16988
diff changeset
3430 if (gtkconv->u.im->typing_timer != 0) {
15725
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3431 g_source_remove(gtkconv->u.im->typing_timer);
17002
af4181dde6fa fix the typing animation so it doesn't stop animating once a conversation
Nathan Walp <nwalp@pidgin.im>
parents: 16988
diff changeset
3432 gtkconv->u.im->typing_timer = 0;
af4181dde6fa fix the typing animation so it doesn't stop animating once a conversation
Nathan Walp <nwalp@pidgin.im>
parents: 16988
diff changeset
3433 }
21897
a64a7bc69f42 Avoid jumpiness when typing notification in the conv. history is removed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21896
diff changeset
3434 update_typing_message(gtkconv, "\n");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3435 return;
15725
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3436 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3437
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
3438 if (purple_conv_im_get_typing_state(im) == PURPLE_TYPING) {
15725
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3439 if (gtkconv->u.im->typing_timer == 0) {
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3440 gtkconv->u.im->typing_timer = g_timeout_add(250, typing_animation, gtkconv);
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3441 }
f322fa6c5318 Typing notification icon
Sean Egan <seanegan@gmail.com>
parents: 15724
diff changeset
3442 stock_id = PIDGIN_STOCK_ANIMATION_TYPING1;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3443 tooltip = _("User is typing...");
21914
44abd56f3298 Use aliases in the typing notification.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21913
diff changeset
3444 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
3445 } else {
17050
580c6c5d9480 Make 'typed' icon not have any keys depressed. Should fix #1116
Sean Egan <seanegan@gmail.com>
parents: 17045
diff changeset
3446 stock_id = PIDGIN_STOCK_ANIMATION_TYPING5;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3447 tooltip = _("User has typed something and stopped");
21914
44abd56f3298 Use aliases in the typing notification.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21913
diff changeset
3448 message = g_strdup_printf(_("\n%s has typed something and stopped"), purple_conversation_get_title(conv));
19230
da310fe624f1 Don't try to remove a timer that doesn't exist
Mark Doliner <mark@kingant.net>
parents: 19229
diff changeset
3449 if (gtkconv->u.im->typing_timer != 0) {
da310fe624f1 Don't try to remove a timer that doesn't exist
Mark Doliner <mark@kingant.net>
parents: 19229
diff changeset
3450 g_source_remove(gtkconv->u.im->typing_timer);
da310fe624f1 Don't try to remove a timer that doesn't exist
Mark Doliner <mark@kingant.net>
parents: 19229
diff changeset
3451 gtkconv->u.im->typing_timer = 0;
da310fe624f1 Don't try to remove a timer that doesn't exist
Mark Doliner <mark@kingant.net>
parents: 19229
diff changeset
3452 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3453 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3454
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3455 if (gtkwin->menu.typing_icon == NULL)
16315
ee4ce3c4186f Fix #248 (Control shouldn't steal focus from scrollback)
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16286
diff changeset
3456 {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3457 gtkwin->menu.typing_icon = gtk_image_new_from_stock(stock_id, GTK_ICON_SIZE_MENU);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3458 pidgin_menu_tray_append(PIDGIN_MENU_TRAY(gtkwin->menu.tray),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3459 gtkwin->menu.typing_icon,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3460 tooltip);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3461 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3462 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3463 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3464 gtk_image_set_from_stock(GTK_IMAGE(gtkwin->menu.typing_icon), stock_id, GTK_ICON_SIZE_MENU);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
3465 pidgin_menu_tray_set_tooltip(PIDGIN_MENU_TRAY(gtkwin->menu.tray),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3466 gtkwin->menu.typing_icon,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3467 tooltip);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3468 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3469
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3470 gtk_widget_show(gtkwin->menu.typing_icon);
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;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4910
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4911 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
4912 conv->ui_data = gtkconv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4913 if (!g_list_find(gtkconv->convs, conv))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4914 gtkconv->convs = g_list_prepend(gtkconv->convs, conv);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
4915 pidgin_conv_switch_active_conversation(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4916 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4917 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4918
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4919 gtkconv = g_new0(PidginConversation, 1);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4920 conv->ui_data = gtkconv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4921 gtkconv->active_conv = conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4922 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
4923 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
4924
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4925 /* Setup some initial variables. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4926 gtkconv->tooltips = gtk_tooltips_new();
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
4927 gtkconv->unseen_state = PIDGIN_UNSEEN_NONE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4928 gtkconv->unseen_count = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4929
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4930 if (conv_type == PURPLE_CONV_TYPE_IM) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4931 gtkconv->u.im = g_malloc0(sizeof(PidginImPane));
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4932 } 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
4933 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
4934 }
34325294c703 Remove code duplication when creating im/chat panes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17397
diff changeset
4935 pane = setup_common_pane(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4936
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4937 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
4938 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
4939
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4940 if (pane == NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4941 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
4942 g_free(gtkconv->u.chat);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
4943 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
4944 g_free(gtkconv->u.im);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4945
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4946 g_free(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4947 conv->ui_data = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4948 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4949 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4950
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4951 /* Setup drag-and-drop */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4952 gtk_drag_dest_set(pane,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4953 GTK_DEST_DEFAULT_MOTION |
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4954 GTK_DEST_DEFAULT_DROP,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4955 te, sizeof(te) / sizeof(GtkTargetEntry),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4956 GDK_ACTION_COPY);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4957 gtk_drag_dest_set(pane,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4958 GTK_DEST_DEFAULT_MOTION |
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4959 GTK_DEST_DEFAULT_DROP,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4960 te, sizeof(te) / sizeof(GtkTargetEntry),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4961 GDK_ACTION_COPY);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4962 gtk_drag_dest_set(gtkconv->imhtml, 0,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4963 te, sizeof(te) / sizeof(GtkTargetEntry),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4964 GDK_ACTION_COPY);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4965
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4966 gtk_drag_dest_set(gtkconv->entry, 0,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4967 te, sizeof(te) / sizeof(GtkTargetEntry),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4968 GDK_ACTION_COPY);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4969
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
4970 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
4971 G_CALLBACK(ignore_middle_click), NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4972 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
4973 G_CALLBACK(conv_dnd_recv), gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4974 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
4975 G_CALLBACK(conv_dnd_recv), gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4976 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
4977 G_CALLBACK(conv_dnd_recv), gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4978
21875
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
4979 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
4980 "foreground", "#888888",
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
4981 "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
4982 "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
4983 "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
4984 NULL);
21875
7efb9a7de561 Typing notification in the conversation history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21848
diff changeset
4985
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4986 /* Setup the container for the tab. */
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
4987 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
4988 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
4989 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
4990 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
4991 gtk_widget_show(pane);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4992
19980
959b3aaba0b6 Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
4993 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
4994 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
4995 gtkconv->make_sound = TRUE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4996
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
4997 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
4998 gtk_widget_show(gtkconv->toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4999 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5000 gtk_widget_hide(gtkconv->toolbar);
21665
baa25b613999 Clean up warnings
Sean Egan <seanegan@gmail.com>
parents: 21664
diff changeset
5001 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
5002
18602
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
5003 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
5004 gtk_widget_show(gtkconv->infopane_hbox);
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
5005 else
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
5006 gtk_widget_hide(gtkconv->infopane_hbox);
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
5007
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5008 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
5009 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
5010 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
5011 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
5012
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5013 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
5014 G_CALLBACK(gtk_widget_grab_focus),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5015 gtkconv->entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5016
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5017 if (hidden)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5018 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
5019 else
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
5020 pidgin_conv_placement_place(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5021
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5022 if (nick_colors == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5023 nbr_nick_colors = NUM_NICK_COLORS;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5024 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
5025 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5026 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5027
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5028 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5029 pidgin_conv_new_hidden(PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5030 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5031 private_gtkconv_new(conv, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5032 }
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 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5035 pidgin_conv_new(PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5036 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5037 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
5038 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
5039 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
5040 "conversation-displayed", PIDGIN_CONVERSATION(conv));
15374
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5043 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5044 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
5045 PurpleConversation *conv, PurpleMessageFlags flags)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5046 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5047 PurpleConversationUiOps *ui_ops = pidgin_conversations_get_conv_ui_ops();
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5048 gboolean hide = FALSE;
19897
922960f829f9 disapproval of revision '08f542359200866bb7a302653d875cdeccb8df01'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
5049
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5050 /* 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
5051 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
5052 hide = TRUE;
19897
922960f829f9 disapproval of revision '08f542359200866bb7a302653d875cdeccb8df01'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
5053
922960f829f9 disapproval of revision '08f542359200866bb7a302653d875cdeccb8df01'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
5054 /* 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
5055 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
5056 !purple_status_is_available(purple_account_get_active_status(account)))
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5057 hide = TRUE;
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5058
21772
21371ea85970 Fix boldifying the chat entries in the buddylist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21766
diff changeset
5059 if (conv && PIDGIN_IS_PIDGIN_CONVERSATION(conv) && !hide) {
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5060 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5061 if (gtkconv->win == hidden_convwin) {
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5062 pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv);
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5063 pidgin_conv_placement_place(gtkconv);
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5064 }
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5065 return;
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5066 }
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5067
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
5068 if (hide) {
19897
922960f829f9 disapproval of revision '08f542359200866bb7a302653d875cdeccb8df01'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
5069 ui_ops->create_conversation = pidgin_conv_new_hidden;
922960f829f9 disapproval of revision '08f542359200866bb7a302653d875cdeccb8df01'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
5070 purple_conversation_new(PURPLE_CONV_TYPE_IM, account, sender);
922960f829f9 disapproval of revision '08f542359200866bb7a302653d875cdeccb8df01'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19896
diff changeset
5071 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
5072 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5073 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5074
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5075 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5076 pidgin_conv_destroy(PurpleConversation *conv)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5077 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5078 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5079
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5080 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
5081 /* 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
5082 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
5083 /* 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
5084 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
5085 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
5086 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
5087 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5088 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
5089 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5090
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5091 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
5092
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5093 /* 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
5094 purple_request_close_with_handle(gtkconv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5095 purple_notify_close_with_handle(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5096
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5097 gtk_widget_destroy(gtkconv->tab_cont);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5098 g_object_unref(gtkconv->tab_cont);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5099
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5100 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
5101 if (gtkconv->u.im->icon_timer != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5102 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
5103
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5104 if (gtkconv->u.im->anim != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5105 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
5106
16273
143b508024c0 Patch from khc to remove the typing notifcation callback when the window is
Stu Tomlinson <stu@nosnilmot.com>
parents: 16229
diff changeset
5107 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
5108 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
5109
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5110 g_free(gtkconv->u.im);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5111 } 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
5112 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
5113 g_free(gtkconv->u.chat);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5114 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5115
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5116 gtk_object_sink(GTK_OBJECT(gtkconv->tooltips));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5117
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5118 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
5119 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
5120 g_list_free(gtkconv->send_history);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5121
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
5122 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
5123 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
5124 }
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
5125
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5126 g_free(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5127 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5128
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5129
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5130 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5131 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
5132 const char *message, PurpleMessageFlags flags,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5133 time_t mtime)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5134 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5135 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5136
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5137 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5138
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5139 if (conv != gtkconv->active_conv &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5140 flags & PURPLE_MESSAGE_ACTIVE_ONLY)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5141 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5142 /* 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
5143 * 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
5144 * before being written to the log. */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5145 purple_debug_info("gtkconv",
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
5146 "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
5147 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5148 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5149
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5150 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
5151 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5152
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5153 /* 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
5154 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
5155 GdkEvent *event, GtkTextIter *arg2, gpointer data) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5156 if (event->type == GDK_BUTTON_PRESS
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5157 || event->type == GDK_2BUTTON_PRESS) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5158 GdkEventButton *btn_event = (GdkEventButton*) event;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5159 PurpleConversation *conv = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5160 char *buddyname;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5161
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5162 /* strlen("BUDDY ") == 6 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5163 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
5164 && (strlen(tag->name) > 6), FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5165
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5166 buddyname = (tag->name) + 6;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5167
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5168 if (btn_event->button == 2
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5169 && event->type == GDK_2BUTTON_PRESS) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5170 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
5171
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5172 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5173 } else if (btn_event->button == 3
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5174 && event->type == GDK_BUTTON_PRESS) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5175 GtkTextIter start, end;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5176
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5177 /* we shouldn't display the popup
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5178 * if the user has selected something: */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5179 if (!gtk_text_buffer_get_selection_bounds(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5180 gtk_text_iter_get_buffer(arg2),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5181 &start, &end)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5182 GtkWidget *menu = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5183 PurpleConnection *gc =
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5184 purple_conversation_get_gc(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5185
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5186
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5187 menu = create_chat_menu(conv, buddyname, gc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5188 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
5189 NULL, GTK_WIDGET(imhtml),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5190 btn_event->button,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5191 btn_event->time);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5192
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5193 /* Don't propagate the event any further */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5194 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5195 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5196 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5197 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5198
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5199 return FALSE;
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
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5202 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
5203 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5204 GtkTextTag *buddytag;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5205 gchar *str;
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 str = g_strdup_printf("BUDDY %s", who);
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 buddytag = gtk_text_tag_table_lookup(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5210 gtk_text_buffer_get_tag_table(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5211 GTK_IMHTML(gtkconv->imhtml)->text_buffer), str);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5212
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5213 if (buddytag == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5214 buddytag = gtk_text_buffer_create_tag(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5215 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
5216
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5217 g_signal_connect(G_OBJECT(buddytag), "event",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5218 G_CALLBACK(buddytag_event), conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5219 }
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 g_free(str);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5222
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5223 return buddytag;
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
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
5226 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
5227 {
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5228 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
5229
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5230 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
5231 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
5232
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5233 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
5234 }
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
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5236 /* 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
5237 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
5238 static void
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5239 str_embed_direction_chars(char **str)
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5240 {
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
5241 #ifdef HAVE_PANGO14
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5242 char pre_str[4];
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5243 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
5244 char *ret;
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5245
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5246 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
5247 {
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
5248 sprintf(pre_str, "%c%c%c",
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5249 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
5250 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
5251 0xE2, 0x80, 0xAC, /* PDF */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5252 0xE2, 0x80, 0x8E, /* LRM */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5253 0xE2, 0x80, 0xAC); /* PDF */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5254 }
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5255 else
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5256 {
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
5257 sprintf(pre_str, "%c%c%c",
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5258 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
5259 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
5260 0xE2, 0x80, 0xAC, /* PDF */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5261 0xE2, 0x80, 0x8F, /* RLM */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5262 0xE2, 0x80, 0xAC); /* PDF */
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5263 }
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 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
5266
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5267 g_free(*str);
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5268 *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
5269 #endif
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5270 }
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 /* 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
5273 static gboolean
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5274 html_is_rtl(const char *html)
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5275 {
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5276 GData *attributes;
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5277 const gchar *start, *end;
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5278 gboolean res = FALSE;
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5279
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5280 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
5281 {
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5282 /* 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
5283 const char *tmp = g_datalist_get_data(&attributes, "dir");
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5284 if (tmp && !g_ascii_strcasecmp(tmp, "RTL"))
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5285 res = TRUE;
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5286 if (!res)
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5287 {
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5288 tmp = g_datalist_get_data(&attributes, "style");
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5289 if (tmp)
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5290 {
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5291 char *tmp2 = purple_markup_get_css_property(tmp, "direction");
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5292 if (tmp2 && !g_ascii_strcasecmp(tmp2, "RTL"))
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5293 res = TRUE;
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5294 g_free(tmp2);
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5295 }
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5296
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5297 }
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5298 g_datalist_clear(&attributes);
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5299 }
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5300 return res;
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5301 }
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5302
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5303
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5304 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5305 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
5306 const char *message, PurpleMessageFlags flags,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5307 time_t mtime)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5308 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5309 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5310 PidginWindow *win;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5311 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5312 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5313 PurplePluginProtocolInfo *prpl_info;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5314 int gtk_font_options = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5315 int gtk_font_options_all = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5316 int max_scrollback_lines;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5317 int line_count;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5318 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
5319 gboolean show_date;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5320 char *mdate;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5321 char color[10];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5322 char *str;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5323 char *with_font_tag;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5324 char *sml_attrib = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5325 size_t length;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5326 PurpleConversationType type;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5327 char *displaying;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5328 gboolean plugin_return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5329 char *bracket;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5330 int tag_count = 0;
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5331 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
5332 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
5333 GHashTable *smiley_data = NULL;
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
5334
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5335 g_return_if_fail(conv != NULL);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5336 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5337 g_return_if_fail(gtkconv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5338
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
5339 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
5340 /* 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
5341 * 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
5342 * 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
5343 * 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
5344 */
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
5345 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
5346 }
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
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5348 if (conv != gtkconv->active_conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5349 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5350 if (flags & PURPLE_MESSAGE_ACTIVE_ONLY)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5351 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5352 /* 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
5353 * 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
5354 * 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
5355 * purple_conversation_write(). */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5356 purple_debug_info("gtkconv",
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
5357 "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
5358 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5359 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5360
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5361 /* 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
5362 /* 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
5363 if (flags & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV))
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
5364 pidgin_conv_switch_active_conversation(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5365 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5366
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5367 type = purple_conversation_get_type(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5368 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5369 g_return_if_fail(account != NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5370 gc = purple_account_get_connection(account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5371 g_return_if_fail(gc != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5372
15579
74b945e7609c Moved linkification of incoming messages to pidgin_conv_write_conv()
Evan Schoenberg <evan.s@dreskin.net>
parents: 15560
diff changeset
5373 /* 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
5374 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
5375 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
5376 else
7790021b1270 add a PURPLE_MESSAGE_NO_LINKIFY to prevent things from getting linkified
Nathan Walp <nwalp@pidgin.im>
parents: 18024
diff changeset
5377 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
5378
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5379 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
5380 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
5381 "displaying-im-msg" : "displaying-chat-msg"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5382 account, name, &displaying, conv, flags));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5383 if (plugin_return)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5384 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5385 g_free(displaying);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5386 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5387 }
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5388 length = strlen(displaying) + 1;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5389
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5390 /* 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
5391 * 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
5392 * needs that much formatting, anyway.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5393 */
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5394 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
5395 tag_count++;
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5396
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5397 if (tag_count > 100) {
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5398 char *tmp = displaying;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5399 displaying = purple_markup_strip_html(tmp);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5400 g_free(tmp);
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5401 }
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5402
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5403 win = gtkconv->win;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5404 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
5405
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5406 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
5407 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
5408 gtkconv->imhtml)));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5409
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5410 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
5411 PIDGIN_PREFS_ROOT "/conversations/scrollback_lines");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5412 /* 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
5413 max scrollback, trim down to max scrollback */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5414 if (max_scrollback_lines > 0
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5415 && line_count > (max_scrollback_lines + 100)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5416 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
5417 GTK_TEXT_VIEW(gtkconv->imhtml));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5418 GtkTextIter start, end;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5419
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5420 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
5421 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
5422 (line_count - max_scrollback_lines));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5423 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
5424 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5425
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5426 if (type == PURPLE_CONV_TYPE_CHAT)
15374
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 /* Create anchor for user */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5429 GtkTextIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5430 char *tmp = g_strconcat("user:", name, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5431
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5432 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
5433 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
5434 tmp, &iter, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5435 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5436 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5437
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
5438 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
5439 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
5440
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5441 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
5442 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
5443
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
5444 /* 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
5445 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
5446 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
5447
b15cc37605c4 In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@wiktel.com>
parents: 15515
diff changeset
5448 /* 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
5449 * 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
5450 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
5451
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5452 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
5453 "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
5454 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
5455
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5456 if (mdate == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5457 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5458 struct tm *tm = localtime(&mtime);
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5459 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
5460 if (show_date)
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5461 tmp = purple_date_format_long(tm);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5462 else
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5463 tmp = purple_time_format(tm);
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5464 mdate = g_strdup_printf("(%s)", tmp);
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5465 }
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5466
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5467 /* 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
5468 is_rtl_message = html_is_rtl(message);
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5469 /* Enforce direction only if message is RTL - doesn't effect LTR users */
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5470 if (is_rtl_message)
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5471 str_embed_direction_chars(&mdate);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5472
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
5473 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
5474 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
5475
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5476 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
5477
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5478 gtk_font_options |= GTK_IMHTML_NO_COMMENTS;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5479
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5480 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
5481 !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
5482 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
5483
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5484 /* 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
5485 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
5486 OPT_PROTO_USE_POINTSIZE) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5487 gtk_font_options |= GTK_IMHTML_USE_POINTSIZE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5488 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5489
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
5490 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
5491 {
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
5492 /* 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
5493 * 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
5494 */
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
5495 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
5496 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
5497 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
5498 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
5499 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
5500 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5501
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5502 /* 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
5503 if (flags & PURPLE_MESSAGE_RAW) {
15602
b03021cef5cb SF Patch #1653845 from Matt Perry
Richard Laager <rlaager@wiktel.com>
parents: 15579
diff changeset
5504 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
5505 } else if (flags & PURPLE_MESSAGE_SYSTEM) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5506 g_snprintf(buf2, sizeof(buf2),
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5507 "<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
5508 sml_attrib ? sml_attrib : "", mdate, displaying);
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 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
5511
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5512 } else if (flags & PURPLE_MESSAGE_ERROR) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5513 g_snprintf(buf2, sizeof(buf2),
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5514 "<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
5515 sml_attrib ? sml_attrib : "", mdate, displaying);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5516
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5517 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
5518
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5519 } 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
5520 g_snprintf(buf2, BUF_LONG,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5521 "<B><FONT %s COLOR=\"#777777\">%s</FONT></B>",
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5522 sml_attrib ? sml_attrib : "", displaying);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5523
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5524 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
5525 } else {
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15465
diff changeset
5526 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
5527 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
5528 /* The initial offset is to deal with
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5529 * escaped entities making the string longer */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5530 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
5531 int tag_end_offset = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5532
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5533 /* Enforce direction on alias */
16084
a5a831a5f186 Patch cleanups:
Richard Laager <rlaager@wiktel.com>
parents: 16083
diff changeset
5534 if (is_rtl_message)
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5535 str_embed_direction_chars(&alias_escaped);
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5536
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5537 if (flags & PURPLE_MESSAGE_WHISPER) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5538 str = g_malloc(1024);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5539
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5540 /* 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
5541 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
5542 g_snprintf(str, 1024, "***%s", alias_escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5543 strcpy(color, "#6C2585");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5544 tag_start_offset += 3;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5545 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5546 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5547 g_snprintf(str, 1024, "*%s*:", alias_escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5548 tag_start_offset += 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5549 tag_end_offset = 2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5550 strcpy(color, "#00FF00");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5551 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5552 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5553 else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5554 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
5555 GdkColor *col;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5556 str = g_malloc(1024);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5557
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5558 if (flags & PURPLE_MESSAGE_AUTO_RESP) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5559 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
5560 tag_start_offset += 4
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5561 + strlen(AUTO_RESPONSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5562 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5563 g_snprintf(str, 1024, "***%s", alias_escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5564 tag_start_offset += 3;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5565 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5566
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5567 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
5568 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
5569 else
21840
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5570 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
5571
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5572 if(col) {
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5573 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
5574 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
5575 }
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5576 else {
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5577 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
5578 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
5579 else
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5580 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
5581 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5582 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5583 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5584 str = g_malloc(1024);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5585 if (flags & PURPLE_MESSAGE_AUTO_RESP) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5586 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
5587 tag_start_offset += 1
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5588 + strlen(AUTO_RESPONSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5589 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5590 g_snprintf(str, 1024, "%s:", alias_escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5591 tag_end_offset = 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5592 }
21840
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5593 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
5594 GdkColor *col;
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5595 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
5596 if(col) {
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5597 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
5598 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
5599 }
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5600 else {
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5601 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
5602 }
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5603 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5604 else if (flags & PURPLE_MESSAGE_RECV) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5605 if (type == PURPLE_CONV_TYPE_CHAT) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5606 GdkColor *col = get_nick_color(gtkconv, name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5607
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5608 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
5609 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
5610 } else {
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5611 GdkColor *col;
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5612 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
5613 if(col) {
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5614 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
5615 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
5616 }
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5617 else {
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5618 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
5619 }
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5620 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5621 }
21840
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5622 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
5623 GdkColor *col;
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5624 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
5625 if(col) {
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5626 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
5627 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
5628 }
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5629 else {
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5630 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
5631 }
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
5632 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5633 else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5634 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
5635 strcpy(color, "#000000");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5636 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5637 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5638 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5639
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5640 g_free(alias_escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5641
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5642 /* 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
5643 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
5644 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
5645
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5646 /* 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
5647 if (flags & PURPLE_MESSAGE_SEND ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5648 flags & PURPLE_MESSAGE_NICK ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5649 purple_find_buddy(account, name) != NULL) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5650 g_snprintf(buf2, BUF_LONG,
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5651 "<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
5652 "<B>%s</B></FONT> ",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5653 color, sml_attrib ? sml_attrib : "", mdate, str);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5654 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5655 g_snprintf(buf2, BUF_LONG,
16083
f2a4b05407d7 Patch from shlomil in ticket #78.
Shlomi Loubaton <shlomister@gmail.com>
parents: 16062
diff changeset
5656 "<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
5657 "%s</FONT> ",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5658 color, sml_attrib ? sml_attrib : "", mdate, str);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5659
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5660 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5661 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5662 /* 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
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 "<B>%s</B></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
18760
bf47d0401a96 Eliminate some unnecessary scrolling activity.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18671
diff changeset
5669 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
5670
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5671 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
5672 !(flags & PURPLE_MESSAGE_SEND)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5673
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5674 GtkTextIter start, end;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5675 GtkTextTag *buddytag = get_buddy_tag(conv, name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5676
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5677 gtk_text_buffer_get_end_iter(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5678 GTK_IMHTML(gtkconv->imhtml)->text_buffer,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5679 &end);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5680 gtk_text_iter_backward_chars(&end,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5681 tag_end_offset + 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5682
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5683 gtk_text_buffer_get_end_iter(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5684 GTK_IMHTML(gtkconv->imhtml)->text_buffer,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5685 &start);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5686 gtk_text_iter_backward_chars(&start,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5687 strlen(str) + 1 - tag_start_offset);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5688
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5689 gtk_text_buffer_apply_tag(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5690 GTK_IMHTML(gtkconv->imhtml)->text_buffer,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5691 buddytag, &start, &end);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5692 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5693
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5694 g_free(str);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5695
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5696 if(gc){
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5697 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
5698 char *post = "</font>";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5699 int pre_len = strlen(pre);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5700 int post_len = strlen(post);
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 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
5703
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5704 strcpy(with_font_tag, pre);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5705 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
5706 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
5707
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5708 length += pre_len + post_len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5709 g_free(pre);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5710 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5711 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5712 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
5713
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5714 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
5715 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
5716
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5717 g_free(with_font_tag);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5718 g_free(new_message);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5719 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5720
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5721 g_free(mdate);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5722 g_free(sml_attrib);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5723
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5724 /* Tab highlighting stuff */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5725 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
5726 {
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
5727 PidginUnseenState unseen = PIDGIN_UNSEEN_NONE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5728
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5729 if ((flags & PURPLE_MESSAGE_NICK) == PURPLE_MESSAGE_NICK)
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
5730 unseen = PIDGIN_UNSEEN_NICK;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5731 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
5732 ((flags & PURPLE_MESSAGE_ERROR) == PURPLE_MESSAGE_ERROR))
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
5733 unseen = PIDGIN_UNSEEN_EVENT;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5734 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
5735 unseen = PIDGIN_UNSEEN_NO_LOG;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5736 else
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
5737 unseen = PIDGIN_UNSEEN_TEXT;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5738
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5739 gtkconv_set_unseen(gtkconv, unseen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5740 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5741
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
5742 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
5743 {
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
5744 /* 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
5745 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
5746 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
5747 }
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
5748
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5749 purple_signal_emit(pidgin_conversations_get_handle(),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5750 (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
5751 account, name, displaying, conv, flags);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5752 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
5753 update_typing_message(gtkconv, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5754 }
19559
11849a5c3951 Update the chat topic and userlist when reattaching the Pidgin UI.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19556
diff changeset
5755
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5756 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5757 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
5758 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5759 PurpleConvChat *chat;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5760 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5761 PidginChatPane *gtkchat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5762 GtkListStore *ls;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5763 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5764
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5765 char tmp[BUF_LONG];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5766 int num_users;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5767
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5768 chat = PURPLE_CONV_CHAT(conv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5769 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5770 gtkchat = gtkconv->u.chat;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5771
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
5772 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
5773
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5774 g_snprintf(tmp, sizeof(tmp),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5775 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
5776 num_users),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5777 num_users);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5778
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5779 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
5780
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5781 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
5782
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5783 #if GTK_CHECK_VERSION(2,6,0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5784 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
5785 GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5786 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5787
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5788 l = cbuddies;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5789 while (l != NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5790 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
5791 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5792 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5793
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5794 /* 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
5795 * 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
5796 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5797 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
5798 GTK_SORT_ASCENDING);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5799 }
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 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5802 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
5803 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
5804 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5805 PurpleConvChat *chat;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5806 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5807 PidginChatPane *gtkchat;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5808 PurpleConvChatBuddyFlags flags;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5809 PurpleConvChatBuddy *cbuddy;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5810 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5811 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5812 int f = 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5813
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5814 chat = PURPLE_CONV_CHAT(conv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5815 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5816 gtkchat = gtkconv->u.chat;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5817
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5818 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
5819
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5820 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
5821 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5822
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5823 while (f != 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5824 char *val;
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 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
5827
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5828 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
5829 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
5830 g_free(val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5831 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5832 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5833
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5834 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
5835
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5836 g_free(val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5837 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5838
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5839 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
5840 return;
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 g_return_if_fail(new_alias != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5843
18305
ffd706ec0220 Set and use convchatbuddy->buddy.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18302
diff changeset
5844 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
5845
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5846 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
5847 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5848
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5849 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5850 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
5851 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5852 PurpleConvChat *chat;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5853 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5854 PidginChatPane *gtkchat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5855 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5856 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5857 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5858 char tmp[BUF_LONG];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5859 int num_users;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5860 gboolean f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5861
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5862 chat = PURPLE_CONV_CHAT(conv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5863 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5864 gtkchat = gtkconv->u.chat;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5865
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
5866 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
5867
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5868 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
5869 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
5870
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5871 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
5872 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5873
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5874 do {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5875 char *val;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5876
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5877 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
5878 CHAT_USERS_NAME_COLUMN, &val, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5879
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5880 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
5881 #if GTK_CHECK_VERSION(2,2,0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5882 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
5883 #else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5884 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
5885 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
5886 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5887 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5888 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5889 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
5890
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5891 g_free(val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5892 } while (f);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5893 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5894
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5895 g_snprintf(tmp, sizeof(tmp),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5896 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
5897 num_users), num_users);
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 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
5900 }
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 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5903 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
5904 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5905 PurpleConvChat *chat;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5906 PurpleConvChatBuddyFlags flags;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5907 PurpleConvChatBuddy *cbuddy;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5908 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5909 PidginChatPane *gtkchat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5910 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5911 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5912 int f = 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5913 char *alias = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5914
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5915 chat = PURPLE_CONV_CHAT(conv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5916 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5917 gtkchat = gtkconv->u.chat;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5918
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5919 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
5920
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5921 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
5922 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5923
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5924 while (f != 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5925 char *val;
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 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
5928
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5929 if (!purple_utf8_strcasecmp(user, val)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5930 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
5931 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
5932 g_free(val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5933 break;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5936 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
5937
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5938 g_free(val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5939 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5940
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5941 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
5942 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5943 g_free(alias);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5944 return;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5947 g_return_if_fail(alias != NULL);
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 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
5950
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
5951 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
5952 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
5953 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
5954 g_free(alias);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5955 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5956
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5957 gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5958 pidgin_conv_has_focus(PurpleConversation *conv)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5959 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5960 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5961 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5962 gboolean has_focus;
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 win = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5965
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5966 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
5967
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
5968 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
5969 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5970
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5971 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5972 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5973
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
5974 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
5975 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5976 GtkIMHtmlSmiley *smiley;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5977
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5978 smiley = (GtkIMHtmlSmiley *)user_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5979 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
5980
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5981 if (smiley->icon)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5982 g_object_ref(G_OBJECT(smiley->icon));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5983 #ifdef DEBUG_CUSTOM_SMILEY
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5984 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
5985 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5986 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5987
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
5988 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
5989 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5990 GtkIMHtmlSmiley *smiley;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5991 GtkWidget *icon = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5992 GtkTextChildAnchor *anchor = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5993 GSList *current = NULL;
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 smiley = (GtkIMHtmlSmiley *)user_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5996 if (!smiley->imhtml) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5997 #ifdef DEBUG_CUSTOM_SMILEY
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
5998 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
5999 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6000 g_object_unref(G_OBJECT(loader));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6001 smiley->loader = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6002 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6003 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6004
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6005 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
6006
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6007 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
6008
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6009 #ifdef DEBUG_CUSTOM_SMILEY
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6010 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
6011 icon, smiley->icon, smiley->smile);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6012 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6013 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
6014 GList *wids;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6015 gtk_widget_show(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 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
6018 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
6019
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6020 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
6021 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
6022
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
6023 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
6024 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
6025 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
6026 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
6027 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
6028 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
6029 } 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
6030 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
6031 }
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 g_list_free(wids);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6033 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6034
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6035 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6036
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6037 g_slist_free(smiley->anchors);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6038 smiley->anchors = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6039
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6040 g_object_unref(G_OBJECT(loader));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6041 smiley->loader = NULL;
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 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6045 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
6046 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6047 GtkIMHtmlSmiley *smiley;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6048 GdkPixbufLoader *loader;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6049
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6050 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
6051
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6052 if (smiley) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6053
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6054 if (!(smiley->flags & GTK_IMHTML_SMILEY_CUSTOM)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6055 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6056 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6057
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6058 /* 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
6059 * the smiley we are about to receive */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6060 g_object_unref(G_OBJECT(smiley->icon));
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 /* 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
6063 smiley->loader = gdk_pixbuf_loader_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6064 smiley->icon = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6065
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6066 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
6067 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
6068
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6069 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6070 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6071
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6072 loader = gdk_pixbuf_loader_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6073
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6074 /* 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
6075 /* 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
6076 GtkIMHtmlSmiley by opaque */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6077 smiley = g_new0(GtkIMHtmlSmiley, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6078 smiley->file = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6079 smiley->smile = g_strdup(smile);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6080 smiley->loader = loader;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6081 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
6082
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6083 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
6084 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
6085
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6086 gtk_imhtml_associate_smiley(imhtml, sml, smiley);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6087
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6088 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6089 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6090
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6091 static gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6092 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
6093 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6094 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6095 struct smiley_list *list;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6096 const char *sml = NULL, *conv_sml;
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 if (!conv || !smile || !*smile) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6099 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6100 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6101
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6102 /* 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
6103 if (pidgin_themes_smileys_disabled())
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6104 return FALSE;
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 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
6107 * 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
6108 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
6109 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6110
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6111 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
6112 if (!strcmp(list->sml, conv_sml)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6113 sml = list->sml;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6114 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6115 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6116 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6117
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6118 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
6119 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6120
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6121 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
6122 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
6123 return FALSE;
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 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6126 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6127
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6128 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6129 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
6130 const guchar *data, gsize size)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6131 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6132 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6133 GtkIMHtmlSmiley *smiley;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6134 GdkPixbufLoader *loader;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6135 const char *sml;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6136
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6137 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
6138 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6139 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
6140
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6141 if (!smiley)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6142 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6143
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6144 loader = smiley->loader;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6145 if (!loader)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6146 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6147
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6148 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
6149 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6150
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6151 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6152 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
6153 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6154 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6155 GtkIMHtmlSmiley *smiley;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6156 GdkPixbufLoader *loader;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6157 const char *sml;
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 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6160 g_return_if_fail(smile != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6161
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6162 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
6163 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6164 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
6165
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6166 if (!smiley)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6167 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6168
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6169 loader = smiley->loader;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6170
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6171 if (!loader)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6172 return;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6175
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6176 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
6177
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6178 gdk_pixbuf_loader_close(loader, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6179
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6180 }
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 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6183 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
6184 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6185 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6186
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6187 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
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 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6191 * 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
6192 * 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
6193 * account signs on or off.
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 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6196 gray_stuff_out(PidginConversation *gtkconv)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6197 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6198 PidginWindow *win;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6199 PurpleConversation *conv = gtkconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6200 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6201 PurplePluginProtocolInfo *prpl_info = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6202 GdkPixbuf *window_icon = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6203 GtkIMHtmlButtons buttons;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6204 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6205
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6206 win = pidgin_conv_get_window(gtkconv);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6207 gc = purple_conversation_get_gc(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6208 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6209
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6210 if (gc != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6211 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
6212
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6213 if (win->menu.send_to != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6214 update_send_to_selection(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6215
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6216 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6217 * 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
6218 * 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
6219 * 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
6220 * 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
6221 * 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
6222 * is sensitive or not.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6223 */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6224 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
6225 /* 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
6226
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6227 /* Deal with menu items */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6228 gtk_widget_show(win->menu.view_log);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6229 gtk_widget_show(win->menu.send_file);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6230 gtk_widget_show(win->menu.add_pounce);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6231 gtk_widget_show(win->menu.get_info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6232 gtk_widget_hide(win->menu.invite);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6233 gtk_widget_show(win->menu.alias);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6234 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
6235 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
6236 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
6237 } 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
6238 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
6239 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
6240 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6241
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6242 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
6243 gtk_widget_show(win->menu.add);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6244 gtk_widget_hide(win->menu.remove);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6245 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6246 gtk_widget_show(win->menu.remove);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6247 gtk_widget_hide(win->menu.add);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6248 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6249
17776
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
6250 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
6251 gtk_widget_show(win->menu.insert_image);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6252 } 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
6253 /* 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
6254
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6255 /* Deal with menu items */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6256 gtk_widget_show(win->menu.view_log);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6257 gtk_widget_hide(win->menu.send_file);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6258 gtk_widget_hide(win->menu.add_pounce);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6259 gtk_widget_hide(win->menu.get_info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6260 gtk_widget_show(win->menu.invite);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6261 gtk_widget_show(win->menu.alias);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6262 gtk_widget_hide(win->menu.block);
15555
883bf81c8d73 Hide the unblock menuitem for chats.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15465
diff changeset
6263 gtk_widget_hide(win->menu.unblock);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6264
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6265 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
6266 /* 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
6267 gtk_widget_show(win->menu.add);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6268 gtk_widget_hide(win->menu.remove);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6269 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6270 /* 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
6271 gtk_widget_hide(win->menu.add);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6272 gtk_widget_show(win->menu.remove);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6273 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6274
17776
68d034c6e65d Bring back Conversation->Insert Link and Conversation->Insert Image.
Stu Tomlinson <stu@nosnilmot.com>
parents: 17725
diff changeset
6275 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
6276 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
6277 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6278
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6279 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6280 * 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
6281 * and what features that account supports.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6282 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6283 if ((gc != NULL) &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6284 ((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
6285 !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
6286 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6287 /* Account is online */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6288 /* Deal with the toolbar */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6289 if (conv->features & PURPLE_CONNECTION_HTML)
15374
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 buttons = GTK_IMHTML_ALL; /* Everything on */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6292 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
6293 buttons &= ~GTK_IMHTML_BACKCOLOR;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6294 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
6295 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6296 buttons &= ~GTK_IMHTML_GROW;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6297 buttons &= ~GTK_IMHTML_SHRINK;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6298 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6299 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
6300 buttons &= ~GTK_IMHTML_LINKDESC;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6301 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6302 buttons = GTK_IMHTML_SMILEY | GTK_IMHTML_IMAGE;
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
18167
b8b475f31008 Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <stu@nosnilmot.com>
parents: 18121
diff changeset
6305 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
6306 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
6307
b8b475f31008 Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <stu@nosnilmot.com>
parents: 18121
diff changeset
6308 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
6309 buttons &= ~GTK_IMHTML_IMAGE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6310
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6311 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
6312 if (account != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6313 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
6314
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6315 /* Deal with menu items */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6316 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
6317 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
6318 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
6319 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
6320 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
6321 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
6322
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6323 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
6324 {
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, (prpl_info->add_buddy != NULL));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6326 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
6327 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
6328 (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
6329 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
6330 gtk_widget_set_sensitive(win->menu.alias,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6331 (account != NULL) &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6332 (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
6333 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6334 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
6335 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6336 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
6337 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
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_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
6341 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6342
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6343 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6344 /* Account is offline */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6345 /* 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
6346
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6347 /* Then deal with menu items */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6348 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
6349 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
6350 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
6351 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
6352 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
6353 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
6354 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
6355 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
6356 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
6357 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
6358 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6359
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6360 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6361 * Update the window's icon
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6362 */
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6363 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
6364 {
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
6365 GList *l = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6366 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
6367 (gtkconv->u.im->anim))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6368 {
20183
dd4c3d712835 applied changes from 9d5a2f820265e4631d68d0f12a2def66acf36e3d
Richard Laager <rlaager@wiktel.com>
parents: 20028
diff changeset
6369 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
6370 window_icon =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6371 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
6372
dd4c3d712835 applied changes from 9d5a2f820265e4631d68d0f12a2def66acf36e3d
Richard Laager <rlaager@wiktel.com>
parents: 20028
diff changeset
6373 if (buddy && !PURPLE_BUDDY_IS_ONLINE(buddy))
dd4c3d712835 applied changes from 9d5a2f820265e4631d68d0f12a2def66acf36e3d
Richard Laager <rlaager@wiktel.com>
parents: 20028
diff changeset
6374 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
6375
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6376 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
6377 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
6378 } 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
6379 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
6380 }
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
6381 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
6382 if (window_icon != NULL) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6383 g_object_unref(G_OBJECT(window_icon));
15749
74923b83e042 Fix a small leak
Sean Egan <seanegan@gmail.com>
parents: 15748
diff changeset
6384 g_list_free(l);
74923b83e042 Fix a small leak
Sean Egan <seanegan@gmail.com>
parents: 15748
diff changeset
6385 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6386 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6387 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6388
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6389 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6390 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
6391 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6392 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6393 PidginWindow *win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6394
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6395 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6396 if (!gtkconv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6397 return;
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6398 win = pidgin_conv_get_window(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6399 if (!win)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6400 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6401
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6402 if (fields & PIDGIN_CONV_SET_TITLE)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6403 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6404 purple_conversation_autoset_title(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6405 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6406
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6407 if (fields & PIDGIN_CONV_BUDDY_ICON)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6408 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6409 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
6410 pidgin_conv_update_buddy_icon(conv);
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6411 }
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6412
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6413 if (fields & PIDGIN_CONV_MENU)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6414 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6415 gray_stuff_out(PIDGIN_CONVERSATION(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6416 generate_send_to_items(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6417 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6418
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6419 if (fields & PIDGIN_CONV_TAB_ICON)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6420 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6421 update_tab_icon(conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6422 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
6423 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6424
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6425 if ((fields & PIDGIN_CONV_TOPIC) &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6426 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
6427 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6428 const char *topic;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6429 PurpleConvChat *chat = PURPLE_CONV_CHAT(conv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6430 PidginChatPane *gtkchat = gtkconv->u.chat;
15374
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 if (gtkchat->topic_text != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6433 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6434 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
6435
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6436 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
6437 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
6438 topic ? topic : "", NULL);
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6441
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6442 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
6443 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
6444
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6445 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
6446 (fields & PIDGIN_CONV_SET_TITLE) ||
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6447 (fields & PIDGIN_CONV_TOPIC))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6448 {
19291
c003aa584909 Remove truncation until we can do it smarter
Sean Egan <seanegan@gmail.com>
parents: 19290
diff changeset
6449 char *title;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6450 PurpleConvIm *im = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6451 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
6452 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
6453 PurplePresence *p = NULL;
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6454 char *markup = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6455 AtkObject *accessibility_obj;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6456 /* 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
6457 char *style;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6458
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6459 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
6460 im = PURPLE_CONV_IM(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6461
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6462 if ((account == NULL) ||
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6463 !purple_account_is_connected(account) ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6464 ((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
6465 && 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
6466 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
6467 else
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6468 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
6469
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6470 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
6471 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
6472 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
6473 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
6474 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
6475 } else {
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6476 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
6477 }
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6478 } 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
6479 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
6480 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
6481 #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
6482 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
6483 #else
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6484 /* 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
6485 * 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
6486 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
6487 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
6488 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
6489 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
6490 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
6491 len++;
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6492 }
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6493 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
6494 *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
6495 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
6496 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
6497 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
6498 }
ef855b0026d1 Truncate the topic to an arbitrary 72 characters in the infopane when using
Stu Tomlinson <stu@nosnilmot.com>
parents: 21704
diff changeset
6499 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
6500 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
6501 #endif
18290
2e7a9f33cfd3 Handle NULL chat topics
Sean Egan <seanegan@gmail.com>
parents: 18289
diff changeset
6502 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
6503 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
6504 esc && *esc ? "\n" : "",
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6505 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
6506 esc ? esc : "");
c8f18378045c Properly escape the chat-topics in the infopane. Fixes #1903.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18876
diff changeset
6507 g_free(esc);
18215
16bf31872b7a Chat topics in status line of chat infopanes
Sean Egan <seanegan@gmail.com>
parents: 18214
diff changeset
6508 }
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
6509 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
6510 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
6511 /* 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
6512 gtk_widget_queue_draw(gtkconv->infopane);
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6513
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
6514 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
6515 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
6516
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6517 if (!GTK_WIDGET_REALIZED(gtkconv->tab_label))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6518 gtk_widget_realize(gtkconv->tab_label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6519
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6520 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
6521 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
6522 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
6523 atk_object_set_description(accessibility_obj, _("Typing"));
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6524 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
6525 } 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
6526 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
6527 atk_object_set_description(accessibility_obj, _("Stopped Typing"));
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6528 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
6529 } 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
6530 atk_object_set_description(accessibility_obj, _("Nick Said"));
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6531 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
6532 } 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
6533 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
6534 if (gtkconv->active_conv->type == PURPLE_CONV_TYPE_CHAT)
21704
a4b36b22ea94 New style.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21703
diff changeset
6535 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
6536 else
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6537 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
6538 } 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
6539 atk_object_set_description(accessibility_obj, _("New Event"));
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6540 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
6541 } 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
6542 style = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6543 }
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
6544
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6545 gtk_widget_set_name(gtkconv->tab_label, style);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6546 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
6547 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
6548
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
6549 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
6550 gtkconv->unseen_state == PIDGIN_UNSEEN_NICK ||
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6551 gtkconv->unseen_state == PIDGIN_UNSEEN_EVENT) {
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6552 PangoAttrList *list = pango_attr_list_new();
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6553 PangoAttribute *attr = pango_attr_weight_new(PANGO_WEIGHT_BOLD);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6554 attr->start_index = 0;
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6555 attr->end_index = -1;
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6556 pango_attr_list_insert(list, attr);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6557 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
6558 pango_attr_list_unref(list);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6559 } else
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
6560 gtk_label_set_attributes(GTK_LABEL(gtkconv->tab_label), NULL);
20902
680e1319b464 Patch from Kramer to boldify the text in tab-titles when the user is typing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20842
diff changeset
6561
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6562 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
6563 update_typing_icon(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6564
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6565 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
6566 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
6567 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
6568
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6569 g_free(title);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6570 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6571 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6572
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6573 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6574 pidgin_conv_updated(PurpleConversation *conv, PurpleConvUpdateType type)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6575 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6576 PidginConvFields flags = 0;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6577
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6578 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6579
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6580 if (type == PURPLE_CONV_UPDATE_ACCOUNT)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6581 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6582 flags = PIDGIN_CONV_ALL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6583 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6584 else if (type == PURPLE_CONV_UPDATE_TYPING ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6585 type == PURPLE_CONV_UPDATE_UNSEEN ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6586 type == PURPLE_CONV_UPDATE_TITLE)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6587 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6588 flags = PIDGIN_CONV_COLORIZE_TITLE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6589 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6590 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
6591 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6592 flags = PIDGIN_CONV_TOPIC;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6593 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6594 else if (type == PURPLE_CONV_ACCOUNT_ONLINE ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6595 type == PURPLE_CONV_ACCOUNT_OFFLINE)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6596 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6597 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
6598 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6599 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
6600 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6601 flags = PIDGIN_CONV_TAB_ICON;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6602 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6603 else if (type == PURPLE_CONV_UPDATE_ADD ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6604 type == PURPLE_CONV_UPDATE_REMOVE ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6605 type == PURPLE_CONV_UPDATE_CHATLEFT)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6606 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6607 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
6608 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6609 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
6610 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6611 flags = PIDGIN_CONV_BUDDY_ICON;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6612 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6613 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
6614 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6615 flags = PIDGIN_CONV_MENU;
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6616 }
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6617
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6618 pidgin_conv_update_fields(conv, flags);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6619 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6620
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
6621 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
6622 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
6623 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
6624 {
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
6625 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
6626 return;
20953
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
6627 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
6628 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
6629
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
6630 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
6631 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
6632 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
6633 ((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
6634 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
6635 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
6636 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
6637 else
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
6638 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
6639
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
6640 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
6641 }
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
6642 }
ee5b3ac0d41d "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19899
diff changeset
6643
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6644 static PurpleConversationUiOps conversation_ui_ops =
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6645 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6646 pidgin_conv_new,
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6647 pidgin_conv_destroy, /* destroy_conversation */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6648 NULL, /* write_chat */
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6649 pidgin_conv_write_im, /* write_im */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6650 pidgin_conv_write_conv, /* write_conv */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6651 pidgin_conv_chat_add_users, /* chat_add_users */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6652 pidgin_conv_chat_rename_user, /* chat_rename_user */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6653 pidgin_conv_chat_remove_users, /* chat_remove_users */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6654 pidgin_conv_chat_update_user, /* chat_update_user */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6655 pidgin_conv_present_conversation, /* present */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6656 pidgin_conv_has_focus, /* has_focus */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6657 pidgin_conv_custom_smiley_add, /* custom_smiley_add */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6658 pidgin_conv_custom_smiley_write, /* custom_smiley_write */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6659 pidgin_conv_custom_smiley_close, /* custom_smiley_close */
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6660 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
6661 NULL,
fbf111436896 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16604
diff changeset
6662 NULL,
fbf111436896 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16604
diff changeset
6663 NULL,
fbf111436896 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16604
diff changeset
6664 NULL
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6665 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6666
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6667 PurpleConversationUiOps *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6668 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
6669 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6670 return &conversation_ui_ops;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6671 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6672
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 * Public conversation utility functions
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6675 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6676 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6677 pidgin_conv_update_buddy_icon(PurpleConversation *conv)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6678 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6679 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6680 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6681
16381
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6682 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
6683
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6684 GdkPixbufLoader *loader;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6685 GdkPixbufAnimation *anim;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6686 GError *err = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6687
16381
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6688 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
6689 gconstpointer data = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6690 size_t len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6691
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6692 GdkPixbuf *buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6693
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6694 GtkWidget *event;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6695 GdkPixbuf *scale;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6696 int scale_width, scale_height;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6697
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6698 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6699 PurplePluginProtocolInfo *prpl_info = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6700
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6701 PurpleBuddyIcon *icon;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6702
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6703 g_return_if_fail(conv != NULL);
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
6704 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
6705 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
6706
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6707 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6708 win = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6709 if (conv != gtkconv->active_conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6710 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6711
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6712 if (!gtkconv->u.im->show_icon)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6713 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6714
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6715 account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6716 if(account && account->gc)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6717 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
6718
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6719 /* Remove the current icon stuff */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6720 if (gtkconv->u.im->icon_container != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6721 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
6722 gtkconv->u.im->icon_container = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6723
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6724 if (gtkconv->u.im->anim != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6725 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
6726
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6727 gtkconv->u.im->anim = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6728
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6729 if (gtkconv->u.im->icon_timer != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6730 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
6731
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6732 gtkconv->u.im->icon_timer = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6733
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6734 if (gtkconv->u.im->iter != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6735 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
6736
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6737 gtkconv->u.im->iter = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6738
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
6739 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
6740 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6741
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6742 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
6743 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6744
16381
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6745 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
6746 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
6747 {
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6748 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
6749 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
6750 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
6751 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
6752 /* 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
6753 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
6754 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
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 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6757 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6758
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6759 if (data == NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6760 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
6761
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6762 if (icon == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6763 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6764
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6765 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
6766
72dc611f3257 Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@wiktel.com>
parents: 16375
diff changeset
6767 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
6768 return;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6771 loader = gdk_pixbuf_loader_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6772 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
6773 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
6774
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
6775 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
6776
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6777 anim = gdk_pixbuf_loader_get_animation(loader);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6778 if (anim)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6779 g_object_ref(G_OBJECT(anim));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6780 g_object_unref(loader);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6781
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6782 if (!anim)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6783 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6784 gtkconv->u.im->anim = anim;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6785
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6786 if (err) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6787 purple_debug(PURPLE_DEBUG_ERROR, "gtkconv",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6788 "Buddy icon error: %s\n", err->message);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6789 g_error_free(err);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6790 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6791
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6792 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
6793 GdkPixbuf *stat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6794 gtkconv->u.im->iter = NULL;
18213
270e87f5cde0 Round the other icons too
Sean Egan <seanegan@gmail.com>
parents: 18212
diff changeset
6795 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
6796 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
6797 } else {
18213
270e87f5cde0 Round the other icons too
Sean Egan <seanegan@gmail.com>
parents: 18212
diff changeset
6798 GdkPixbuf *stat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6799 gtkconv->u.im->iter =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6800 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
6801 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
6802 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
6803 if (gtkconv->u.im->animate)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6804 start_anim(NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6805 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6806
18214
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
6807 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
6808 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
6809 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
6810 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
6811 } 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
6812 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
6813 scale_height = 32;
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
6814 } else {
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
6815 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
6816 scale_width = 32;
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
6817 }
bf0032658576 properly scale buddy icons in infopane to preserve aspect ratio
Sean Egan <seanegan@gmail.com>
parents: 18213
diff changeset
6818 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
6819 GDK_INTERP_BILINEAR);
18213
270e87f5cde0 Round the other icons too
Sean Egan <seanegan@gmail.com>
parents: 18212
diff changeset
6820 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
6821 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
6822 pidgin_gdk_pixbuf_make_round(scale);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6823 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
6824
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6825 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
6826 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
6827 #if GTK_CHECK_VERSION(2,4,0)
18821
0765cf9331f6 warning fixes
Sean Egan <seanegan@gmail.com>
parents: 18820
diff changeset
6828 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
6829 #endif
18781
8b0663abb488 add tooltip to buddy icon in conversation too
Sean Egan <seanegan@gmail.com>
parents: 18779
diff changeset
6830 gtk_widget_add_events(event,
8b0663abb488 add tooltip to buddy icon in conversation too
Sean Egan <seanegan@gmail.com>
parents: 18779
diff changeset
6831 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
6832 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
6833 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
6834
3fc5862b834a Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21914
diff changeset
6835 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
6836 gtk_widget_show(event);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6837
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6838 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
6839 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
6840 gtk_widget_show(gtkconv->u.im->icon);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6841
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6842 g_object_unref(G_OBJECT(scale));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6843
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
6844 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
6845 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
6846
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6847 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
6848
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6849 /* 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
6850 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
6851 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6852 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
6853 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
6854 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6855 }
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 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6858 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
6859 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6860 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6861
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
6862 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6863 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6864
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6865 win = PIDGIN_CONVERSATION(conv)->win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6866
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6867 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
6868 gray_stuff_out(PIDGIN_CONVERSATION(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6869 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6870
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6871 int
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
6872 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
6873 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6874 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
6875 GtkNotebook *notebook;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6876 GtkWidget *page, *tab;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6877 gint i, page_num = -1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6878 gint count;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6879 gboolean horiz;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6880
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6881 if (to_right)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6882 *to_right = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6883
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6884 notebook = GTK_NOTEBOOK(win->notebook);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6885
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6886 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
6887 x_rel = x - nb_x;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6888 y_rel = y - nb_y;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6889
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6890 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
6891 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
6892
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6893 #if GTK_CHECK_VERSION(2,2,0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6894 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
6895 #else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6896 /* 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
6897 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
6898 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6899
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6900 for (i = 0; i < count; i++) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6901
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6902 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
6903 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
6904
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6905 /* 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
6906 if (!GTK_WIDGET_DRAWABLE(tab))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6907 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6908
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6909 if (horiz) {
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
6910 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
6911 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
6912 page_num = i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6913
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6914 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
6915 *to_right = TRUE;
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 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6918 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6919 } else {
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
6920 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
6921 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
6922 page_num = i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6923
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6924 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
6925 *to_right = TRUE;
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 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6928 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6929 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6930 }
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 (page_num == -1) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6933 /* Add after the last tab */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6934 page_num = count - 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6935 }
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 return page_num;
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 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6941 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
6942 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6943 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
6944 GList *l;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6945 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6946 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6947
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6948 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
6949 conv = (PurpleConversation *)l->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6950
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
6951 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6952 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6953
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6954 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6955
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6956 if (value)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6957 gtk_widget_show(gtkconv->close);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6958 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6959 gtk_widget_hide(gtkconv->close);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6960 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6961 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6962
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6963 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6964 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
6965 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6966 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6967 #ifdef USE_GTKSPELL
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
6968 GList *cl;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6969 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6970 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6971 GtkSpell *spell;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6972
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6973 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
6974
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6975 conv = (PurpleConversation *)cl->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6976
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
6977 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6978 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6979
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6980 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6981
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6982 if (value)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
6983 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
6984 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6985 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
6986 gtkspell_detach(spell);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6987 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6988 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6989 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6990 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6991
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6992 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
6993 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
6994 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6995 {
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
6996 GList *gtkwins, *gtkconvs;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6997 GtkPositionType pos;
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
6998 PidginWindow *gtkwin;
15374
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 pos = GPOINTER_TO_INT(value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7001
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
7002 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
7003 gtkwin = gtkwins->data;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
7004 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
7005 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
7006 pidgin_conv_tab_pack(gtkwin, gtkconvs->data);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
7007 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7008 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7009 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7010
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7011 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7012 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
7013 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7014 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
7015 GList *l;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7016 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7017 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7018 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7019
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7020 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
7021 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7022 conv = (PurpleConversation *)l->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7023
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
7024 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7025 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7026
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7027 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7028 win = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7029
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7030 gtk_check_menu_item_set_active(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7031 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
7032 (gboolean)GPOINTER_TO_INT(value));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7033
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7034 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
7035 (gboolean)GPOINTER_TO_INT(value));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7036 }
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7039 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7040 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
7041 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7042 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
7043 GList *l;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7044 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7045 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7046 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7047
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7048 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
7049 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7050 conv = (PurpleConversation *)l->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7051
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15614
diff changeset
7052 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7053 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7054
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7055 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7056 win = gtkconv->win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7057
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7058 gtk_check_menu_item_set_active(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7059 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
7060 (gboolean)GPOINTER_TO_INT(value));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7061
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7062 if ((gboolean)GPOINTER_TO_INT(value))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7063 gtk_widget_show(gtkconv->toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7064 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7065 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
7066
21665
baa25b613999 Clean up warnings
Sean Egan <seanegan@gmail.com>
parents: 21664
diff changeset
7067 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
7068 }
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7071 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7072 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
7073 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7074 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
7075 GList *l;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7076 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7077 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7078 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7079
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7080 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
7081 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7082
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7083 /* 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
7084 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
7085 conv = (PurpleConversation *)l->data;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7086 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
7087 if (gtkconv)
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
7088 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
7089 }
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 /* 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
7092 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
7093 win = l->data;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7094 conv = pidgin_conv_window_get_active_conversation(win);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7095 pidgin_conv_update_buddy_icon(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7096 }
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 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7100 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
7101 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7102 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
7103 GList *l;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7104
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7105 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
7106 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
7107 if (!PIDGIN_CONVERSATION(conv))
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
7108 continue;
18602
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7109 if (GPOINTER_TO_INT(value))
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7110 gtk_widget_show(PIDGIN_CONVERSATION(conv)->infopane_hbox);
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7111 else
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7112 gtk_widget_hide(PIDGIN_CONVERSATION(conv)->infopane_hbox);
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7113
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7114 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
7115 pidgin_conv_update_buddy_icon(conv);
18602
3ac99b2e2168 Infopane is optional
Sean Egan <seanegan@gmail.com>
parents: 18591
diff changeset
7116 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7117 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7118 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7119
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7120 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
7121 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
7122 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
7123 {
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
7124 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
7125 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
7126 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
7127 if (PIDGIN_CONVERSATION(conv))
f3c83871a442 Do not crash for hidden convs after changing prefs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19615
diff changeset
7128 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
7129 }
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 }
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 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7133 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
7134 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7135 {
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7136 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
7137 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7138
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7139 static void
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7140 account_status_changed_cb(PurpleAccount *account, PurpleStatus *oldstatus,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7141 PurpleStatus *newstatus)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7142 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7143 GList *l;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7144 PurpleConversation *conv = NULL;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7145 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7146
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7147 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
7148 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7149
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7150 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
7151 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7152
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7153 while ((l = hidden_convwin->gtkconvs) != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7154 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7155 gtkconv = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7156
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7157 conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7158
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7159 while(l && !purple_status_is_available(
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7160 purple_account_get_active_status(
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7161 purple_conversation_get_account(conv))))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7162 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7163 if (!l)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7164 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7165
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7166 pidgin_conv_window_remove_gtkconv(hidden_convwin, gtkconv);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7167 pidgin_conv_placement_place(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7168
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7169 /* 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
7170 * 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
7171 purple_conversation_update(conv, PURPLE_CONV_UPDATE_UNSEEN);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7172 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7173 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7174
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7175 static void
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7176 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
7177 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7178 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7179 GList *l;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7180 PurpleConversation *conv = NULL;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7181 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7182 gboolean when_away = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7183
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7184 if(!hidden_convwin)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7185 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7186
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7187 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
7188 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7189
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7190 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
7191 when_away = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7192
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
7193 for (l = hidden_convwin->gtkconvs; l; )
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7194 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7195 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
7196 l = l->next;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7197
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7198 conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7199
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
7200 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
7201 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
7202 (when_away && !purple_status_is_available(
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7203 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
7204 purple_conversation_get_account(conv)))))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7205 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7206
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7207 pidgin_conv_window_remove_gtkconv(hidden_convwin, gtkconv);
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7208 pidgin_conv_placement_place(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7209 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7210 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7211
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7212
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7213 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7214 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
7215 gconstpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7216 {
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
7217 PidginConvPlacementFunc func;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7218
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7219 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
7220 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7221
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7222 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
7223
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7224 if (func == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7225 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7226
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7227 pidgin_conv_placement_set_current_func(func);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7228 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7229
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7230 static PidginConversation *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7231 get_gtkconv_with_contact(PurpleContact *contact)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7232 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7233 PurpleBlistNode *node;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7234
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7235 node = ((PurpleBlistNode*)contact)->child;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7236
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7237 for (; node; node = node->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7238 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7239 PurpleBuddy *buddy = (PurpleBuddy*)node;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7240 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7241 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
7242 if (conv)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7243 return PIDGIN_CONVERSATION(conv);
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 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7246 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7247
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7248 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7249 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
7250 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
7251 GList *iter;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7252
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7253 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
7254 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7255 PurpleConversation *conv = iter->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7256
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7257 /* 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
7258 * 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
7259 * 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
7260 * 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
7261 /* if (purple_conversation_get_account(conv) == account) */
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7262 pidgin_conv_update_fields(conv, PIDGIN_CONV_TAB_ICON |
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7263 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
7264
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7265 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
7266 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
7267 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
7268 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
7269 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
7270 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
7271 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
7272 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
7273 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
7274 } else {
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7275 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
7276 }
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7277 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
7278 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
7279 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
7280 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7281 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7282 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7283
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7284 static gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7285 update_buddy_status_timeout(PurpleBuddy *buddy)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7286 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7287 /* 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
7288 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7289
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7290 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
7291 if (conv)
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7292 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
7293
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7294 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7295 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7296
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7297 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7298 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
7299 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7300 PidginConversation *gtkconv;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7301 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7302
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7303 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
7304 if (gtkconv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7305 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7306 conv = gtkconv->active_conv;
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7307 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
7308 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
7309 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
7310 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7311
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7312 /* 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
7313 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
7314 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7315
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7316 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7317 update_buddy_privacy_changed(PurpleBuddy *buddy)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7318 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7319 PidginConversation *gtkconv;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7320 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7321
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7322 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
7323 if (gtkconv) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7324 conv = gtkconv->active_conv;
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7325 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
7326 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7327 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7328
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7329 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7330 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
7331 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7332 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7333
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7334 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
7335 if (conv)
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7336 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
7337 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7338
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7339 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7340 update_buddy_icon(PurpleBuddy *buddy)
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 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7343
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7344 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
7345 if (conv)
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7346 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
7347 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7348
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7349 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7350 update_buddy_sign(PurpleBuddy *buddy, const char *which)
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 PurplePresence *presence;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7353 PurpleStatus *on, *off;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7354
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7355 presence = purple_buddy_get_presence(buddy);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7356 if (!presence)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7357 return;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7358 off = purple_presence_get_status(presence, "offline");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7359 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
7360
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7361 if (*(which+1) == 'f')
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7362 update_buddy_status_changed(buddy, on, off);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7363 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7364 update_buddy_status_changed(buddy, off, on);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7365 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7366
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7367 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7368 update_conversation_switched(PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7369 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7370 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
7371 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
7372 }
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 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7375 update_buddy_typing(PurpleAccount *account, const char *who)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7376 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7377 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7378 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7379
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7380 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
7381 if (!conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7382 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7383
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7384 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7385 if (gtkconv && gtkconv->active_conv == conv)
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7386 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
7387 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7388
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7389 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7390 update_chat(PurpleConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7391 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7392 pidgin_conv_update_fields(conv, PIDGIN_CONV_TOPIC |
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7393 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
7394 }
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 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7397 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
7398 {
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
7399 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
7400 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7401
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7402 /* Message history stuff */
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7403
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7404 /* 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
7405 static int
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7406 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
7407 {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7408 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
7409 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
7410 }
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 /* 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
7413 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
7414 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
7415 {
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7416 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
7417 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
7418 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
7419 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
7420 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
7421
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
7422 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
7423 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
7424 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
7425 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
7426 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
7427 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
7428 }
21263
1812b8ccfd7a Show alias in restored conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21244
diff changeset
7429 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
7430 if (im) {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7431 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
7432 } else {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7433 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
7434 }
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
7435 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
7436 }
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7437 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
7438 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
7439 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
7440
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7441 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
7442 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
7443 if (im) {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7444 /* 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
7445 GList *msgs = NULL;
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7446 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
7447 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
7448 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
7449 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
7450 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
7451 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
7452 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
7453 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
7454 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7455 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7456 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
7457 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
7458 PurpleConvMessage *msg = msgs->data;
21263
1812b8ccfd7a Show alias in restored conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21244
diff changeset
7459 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
7460 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7461 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
7462 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
7463 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7464
20552
b7460582a135 Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20545
diff changeset
7465 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
7466 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
7467 "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
7468 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
7469 }
e8bd9d92202e Adding all the message from history in GtkIMHtml takes a bit long causing
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19417
diff changeset
7470
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7471 static void
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7472 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
7473 {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7474 int timer;
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7475 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
7476 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
7477 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
7478 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
7479 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
7480 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
7481 if (timer) {
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7482 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
7483 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
7484 }
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7485 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7486
19417
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7487 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
7488 {
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7489 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
7490 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
7491
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7492 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
7493 /* This is pretty much always the case now. */
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7494 gtkconv = PIDGIN_CONVERSATION(conv);
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7495 if (gtkconv->win != hidden_convwin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7496 return FALSE;
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7497 pidgin_conv_window_remove_gtkconv(hidden_convwin, gtkconv);
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7498 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
7499 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
7500 "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
7501 list = gtkconv->convs;
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
7502 while (list) {
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
7503 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
7504 list = list->next;
690486065969 Remove the close timer when re-displaying a hidden conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21786
diff changeset
7505 }
21703
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7506 return TRUE;
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21702
diff changeset
7507 }
19417
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7508
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7509 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
7510 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
7511
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7512 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
7513 if (list) {
20179
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7514 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
7515 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
7516 {
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7517 GList *convs;
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7518 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
7519 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
7520 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
7521 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
7522 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
7523 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
7524 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7525 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
7526 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
7527 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
7528 break;
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7529 }
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7530 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
7531 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
7532 break;
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7533 default:
bd7244f3d491 Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20173
diff changeset
7534 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
7535 }
20051
d9a6d6ac2537 We can do this without forcing a minor bump.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20050
diff changeset
7536 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
7537 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
7538 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
7539 } else {
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7540 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
7541 "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
7542 }
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7543
19559
11849a5c3951 Update the chat topic and userlist when reattaching the Pidgin UI.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19556
diff changeset
7544 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
7545 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
7546 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
7547 }
19417
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7548
f3f78f43b822 API to reattach a conversation to gtk UI. Use the new
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19362
diff changeset
7549 return TRUE;
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
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7552 void *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7553 pidgin_conversations_get_handle(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7554 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7555 static int handle;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7556
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7557 return &handle;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7558 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7559
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_init(void)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7562 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7563 void *handle = pidgin_conversations_get_handle();
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7564 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
7565
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7566 /* 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
7567 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
7568 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
7569 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
7570 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
7571 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
7572 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
7573 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
7574 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
7575
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/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
7577 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
7578
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_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
7580 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
7581 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
7582 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
7583 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
7584 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
7585 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
7586 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
7587 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
7588
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
7589 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
7590 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
7591
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7592 /* 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
7593 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
7594 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
7595 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
7596 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
7597 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
7598 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
7599 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
7600
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7601 /* 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
7602 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
7603 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
7604 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
7605 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
7606 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
7607
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7608 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
7609
19229
f1fb41d31c70 Set a larger default conversation size. Previously we were using
Mark Doliner <mark@kingant.net>
parents: 19223
diff changeset
7610 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
7611 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
7612
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7613 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
7614
18779
f6656fd1d2d5 Initialize the win32 minimize new conv. windows pref to avoid warnings.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18760
diff changeset
7615 #ifdef _WIN32
f6656fd1d2d5 Initialize the win32 minimize new conv. windows pref to avoid warnings.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18760
diff changeset
7616 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
7617 #endif
f6656fd1d2d5 Initialize the win32 minimize new conv. windows pref to avoid warnings.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18760
diff changeset
7618
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7619 /* 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
7620 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
7621 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
7622 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
7623 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
7624 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
7625 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
7626 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
7627 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
7628 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
7629 tab_side_pref_cb, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7630
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
7631 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
7632 conv_placement_usetabs_cb, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7633
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/placement",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7635 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
7636 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
7637
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7638 /* 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
7639 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
7640 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
7641 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
7642 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
7643 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
7644 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
7645 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
7646 hide_new_pref_cb, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7647
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7648
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7649
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7650 /**********************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7651 * Register signals
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7652 **********************************************************************/
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7653 purple_signal_register(handle, "conversation-dragging",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7654 purple_marshal_VOID__POINTER_POINTER, NULL, 2,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7655 purple_value_new(PURPLE_TYPE_BOXED,
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7656 "PidginWindow *"),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7657 purple_value_new(PURPLE_TYPE_BOXED,
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7658 "PidginWindow *"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7659
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7660 purple_signal_register(handle, "conversation-timestamp",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7661 #if SIZEOF_TIME_T == 4
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7662 purple_marshal_POINTER__POINTER_INT_BOOLEAN,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7663 #elif SIZEOF_TIME_T == 8
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7664 purple_marshal_POINTER__POINTER_INT64_BOOLEAN,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7665 #else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7666 #error Unkown size of time_t
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7667 #endif
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7668 purple_value_new(PURPLE_TYPE_STRING), 3,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7669 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7670 PURPLE_SUBTYPE_CONVERSATION),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7671 #if SIZEOF_TIME_T == 4
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7672 purple_value_new(PURPLE_TYPE_INT),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7673 #elif SIZEOF_TIME_T == 8
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7674 purple_value_new(PURPLE_TYPE_INT64),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7675 #else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7676 # error Unknown size of time_t
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7677 #endif
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7678 purple_value_new(PURPLE_TYPE_BOOLEAN));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7679
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7680 purple_signal_register(handle, "displaying-im-msg",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7681 purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7682 purple_value_new(PURPLE_TYPE_BOOLEAN), 5,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7683 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7684 PURPLE_SUBTYPE_ACCOUNT),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7685 purple_value_new(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7686 purple_value_new_outgoing(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7687 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7688 PURPLE_SUBTYPE_CONVERSATION),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7689 purple_value_new(PURPLE_TYPE_INT));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7690
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7691 purple_signal_register(handle, "displayed-im-msg",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7692 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
7693 NULL, 5,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7694 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7695 PURPLE_SUBTYPE_ACCOUNT),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7696 purple_value_new(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7697 purple_value_new(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7698 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7699 PURPLE_SUBTYPE_CONVERSATION),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7700 purple_value_new(PURPLE_TYPE_INT));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7701
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7702 purple_signal_register(handle, "displaying-chat-msg",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7703 purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7704 purple_value_new(PURPLE_TYPE_BOOLEAN), 5,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7705 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7706 PURPLE_SUBTYPE_ACCOUNT),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7707 purple_value_new(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7708 purple_value_new_outgoing(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7709 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7710 PURPLE_SUBTYPE_CONVERSATION),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7711 purple_value_new(PURPLE_TYPE_INT));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7712
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7713 purple_signal_register(handle, "displayed-chat-msg",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7714 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
7715 NULL, 5,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7716 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7717 PURPLE_SUBTYPE_ACCOUNT),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7718 purple_value_new(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7719 purple_value_new(PURPLE_TYPE_STRING),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7720 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7721 PURPLE_SUBTYPE_CONVERSATION),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7722 purple_value_new(PURPLE_TYPE_INT));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7723
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7724 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
7725 purple_marshal_VOID__POINTER, NULL, 1,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7726 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7727 PURPLE_SUBTYPE_CONVERSATION));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7728
19556
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7729 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
7730 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
7731 purple_value_new(PURPLE_TYPE_BOXED,
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7732 "PidginConversation *"));
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7733
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7734 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
7735 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
7736 purple_value_new(PURPLE_TYPE_BOXED,
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7737 "PidginConversation *"));
11de4598b4c5 Document the function to reattach conv-ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19518
diff changeset
7738
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7739 /**********************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7740 * Register commands
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7741 **********************************************************************/
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7742 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
7743 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
7744 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
7745 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
7746 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
7747 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
7748 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
7749 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
7750 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
7751 purple_cmd_register("clear", "", PURPLE_CMD_P_DEFAULT,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7752 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
7753 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
7754 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
7755 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
7756 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
7757 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
7758 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
7759 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
7760
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7761 /**********************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7762 * UI operations
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7763 **********************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7764
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7765 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
7766 G_CALLBACK(account_signed_off_cb),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7767 GINT_TO_POINTER(PURPLE_CONV_ACCOUNT_ONLINE));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7768 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
7769 G_CALLBACK(account_signed_off_cb),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7770 GINT_TO_POINTER(PURPLE_CONV_ACCOUNT_OFFLINE));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7771
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7772 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
7773 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
7774
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7775 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
7776
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7777 hidden_convwin = pidgin_conv_window_new();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7778 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
7779
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7780 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
7781 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
7782
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7783 /* Callbacks to update a conversation */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7784 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
7785 G_CALLBACK(buddy_update_cb), NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7786 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
7787 G_CALLBACK(buddy_update_cb), NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7788 purple_signal_connect(blist_handle, "buddy-signed-on",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7789 handle, PURPLE_CALLBACK(update_buddy_sign), "on");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7790 purple_signal_connect(blist_handle, "buddy-signed-off",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7791 handle, PURPLE_CALLBACK(update_buddy_sign), "off");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7792 purple_signal_connect(blist_handle, "buddy-status-changed",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7793 handle, PURPLE_CALLBACK(update_buddy_status_changed), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7794 purple_signal_connect(blist_handle, "buddy-privacy-changed",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7795 handle, PURPLE_CALLBACK(update_buddy_privacy_changed), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7796 purple_signal_connect(blist_handle, "buddy-idle-changed",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7797 handle, PURPLE_CALLBACK(update_buddy_idle_changed), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7798 purple_signal_connect(blist_handle, "buddy-icon-changed",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7799 handle, PURPLE_CALLBACK(update_buddy_icon), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7800 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
7801 handle, PURPLE_CALLBACK(update_buddy_typing), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7802 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
7803 handle, PURPLE_CALLBACK(update_buddy_typing), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7804 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
7805 handle, PURPLE_CALLBACK(update_conversation_switched), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7806 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
7807 PURPLE_CALLBACK(update_chat), 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(), "chat-joined", handle,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7809 PURPLE_CALLBACK(update_chat), 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(), "chat-topic-changed", handle,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7811 PURPLE_CALLBACK(update_chat_topic), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7812 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
7813 PURPLE_CALLBACK(pidgin_conv_updated), NULL,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7814 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
7815 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
7816 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
7817 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
7818 PURPLE_CALLBACK(wrote_msg_update_unseen_cb), NULL);
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7819
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7820 {
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7821 /* Set default tab colors */
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7822 GString *str = g_string_new(NULL);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7823 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
7824 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
7825 struct {
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7826 const char *stylename;
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7827 const char *labelname;
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7828 const char *color;
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7829 } styles[] = {
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7830 {"pidgin_tab_label_typing_default", "tab-label-typing", "#4e9a06"},
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7831 {"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
7832 {"pidgin_tab_label_attention_default", "tab-label-attention", "#006aff"},
21704
a4b36b22ea94 New style.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21703
diff changeset
7833 {"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
7834 {"pidgin_tab_label_event_default", "tab-label-event", "#888a85"},
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7835 {NULL, NULL, NULL}
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7836 };
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7837 int iter;
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7838 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
7839 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
7840 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
7841 (parent && now && parent->rc_style == now->rc_style)) {
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7842 g_string_append_printf(str, "style \"%s\" {\n"
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7843 "fg[ACTIVE] = \"%s\"\n"
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7844 "}\n"
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7845 "widget \"*%s\" style \"%s\"\n",
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7846 styles[iter].stylename,
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7847 styles[iter].color,
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7848 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
7849 }
21701
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7850 }
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7851 gtk_rc_parse_string(str->str);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7852 g_string_free(str, TRUE);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7853 #if GTK_CHECK_VERSION(2,4,0)
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7854 gtk_rc_reset_styles(settings);
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7855 #endif
f15b22236649 Themeable tab label colors.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21671
diff changeset
7856 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7857 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7858
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7859 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7860 pidgin_conversations_uninit(void)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7861 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
7862 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
7863 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
7864 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
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7868
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7869
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7870
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7871
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7872
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 /* 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
7883 * 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
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 * @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
7887 * @ingroup pidgin
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7888 *
15871
66dff3dfdea6 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
7889 * pidgin
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7890 *
15871
66dff3dfdea6 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
7891 * 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
7892 * 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
7893 * source distribution.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7894 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7895 * 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
7896 * 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
7897 * 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
7898 * (at your option) any later version.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7899 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7900 * 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
7901 * 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
7902 * 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
7903 * GNU General Public License for more details.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7904 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7905 * 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
7906 * 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
7907 * 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
7908 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7909 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7910 #include "internal.h"
15514
535f002e7b0f More pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15509
diff changeset
7911 #include "pidgin.h"
15374
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7914 #include <gdk/gdkkeysyms.h>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7915
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7916 #include "account.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7917 #include "cmds.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7918 #include "debug.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7919 #include "imgstore.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7920 #include "log.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7921 #include "notify.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7922 #include "prpl.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7923 #include "request.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7924 #include "util.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7925
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7926 #include "gtkdnd-hints.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7927 #include "gtkblist.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7928 #include "gtkconv.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7929 #include "gtkdialogs.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7930 #include "gtkmenutray.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7931 #include "gtkpounce.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7932 #include "gtkprefs.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7933 #include "gtkprivacy.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7934 #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
7935 #include "pidginstock.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7936 #include "gtkimhtml.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7937 #include "gtkimhtmltoolbar.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7938
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7939 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7940 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
7941 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7942 gtk_widget_destroy(warn_close_dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7943 warn_close_dialog = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7944
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7945 if (resp == GTK_RESPONSE_OK)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7946 pidgin_conv_window_destroy(win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7947 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7948
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7949 static void
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
7950 build_warn_close_dialog(PidginWindow *gtkwin)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7951 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7952 GtkWidget *label;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7953 GtkWidget *vbox, *hbox;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7954 GtkWidget *img;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7955
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7956 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
7957
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7958
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7959 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
7960 _("Confirm close"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7961 GTK_WINDOW(gtkwin->window), GTK_DIALOG_MODAL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7962 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
7963 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
7964
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7965 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
7966 GTK_RESPONSE_OK);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7967
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7968 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
7969 6);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7970 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
7971 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
7972 FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7973
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7974 /* Setup the outside spacing. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7975 vbox = GTK_DIALOG(warn_close_dialog)->vbox;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7976
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7977 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
7978 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
7979
15436
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15435
diff changeset
7980 img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_WARNING,
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15435
diff changeset
7981 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
7982 /* 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
7983 hbox = gtk_hbox_new(FALSE, 12);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7984 gtk_container_add(GTK_CONTAINER(vbox), hbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7985 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
7986 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
7987
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7988 /* Setup the right vbox. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7989 vbox = gtk_vbox_new(FALSE, 12);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7990 gtk_container_add(GTK_CONTAINER(hbox), vbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7991
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7992 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
7993 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
7994 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
7995 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
7996 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
7997
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7998 /* Connect the signals. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7999 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
8000 G_CALLBACK(do_close), gtkwin);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8001
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8002 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8003
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8004 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8005 * Callbacks
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8006 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8007
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8008 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8009 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
8010 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8011 PidginWindow *win = d;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8012 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8013
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8014 /* 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
8015 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
8016 l != NULL; l = l->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8017 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8018 PidginConversation *gtkconv = l->data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8019 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
8020 gtkconv->unseen_state >= PIDGIN_UNSEEN_TEXT)
15374
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 build_warn_close_dialog(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8023 gtk_widget_show_all(warn_close_dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8024
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8025 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8026 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8027 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8028
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8029 pidgin_conv_window_destroy(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8030
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8031 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8032 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8033
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8034 static void
20953
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8035 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
8036 {
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8037 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
8038 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
8039
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8040 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
8041 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
8042
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8043 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
8044 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
8045
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8046 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
8047 {
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8048 unseen_count = 0;
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8049 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
8050 }
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8051 else
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8052 {
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8053 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
8054 unseen_count++;
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 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
8057 unseen_state = state;
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
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8060 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
8061 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
8062
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8063 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
8064 }
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8065
111f4b8084b0 Track the unseen state on the PurpleConversation for dettached convs. This
Casey Harkins <charkins@pidgin.im>
parents: 20952
diff changeset
8066 static void
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
8067 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
8068 {
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
8069 if (state == PIDGIN_UNSEEN_NONE)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8070 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8071 gtkconv->unseen_count = 0;
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
8072 gtkconv->unseen_state = PIDGIN_UNSEEN_NONE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8073 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8074 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8075 {
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
8076 if (state >= PIDGIN_UNSEEN_TEXT)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8077 gtkconv->unseen_count++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8078
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8079 if (state > gtkconv->unseen_state)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8080 gtkconv->unseen_state = state;
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
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8083 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
8084 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8085
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8086 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8087 * 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
8088 * 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
8089 * messages.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8090 */
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
8091 static gboolean
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8092 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
8093 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8094 PidginWindow *win = d;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8095 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
8096
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
8097 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
8098 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
8099
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8100 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8101 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8102
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8103 #if !GTK_CHECK_VERSION(2,6,0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8104 /* Courtesy of Galeon! */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8105 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8106 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
8107 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8108 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
8109 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
8110 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8111 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8112
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8113 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8114 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
8115 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8116 static GdkCursor *cursor = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8117
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8118 gtkwin->in_drag = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8119
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8120 if (gtkwin->drag_leave_signal) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8121 g_signal_handler_disconnect(G_OBJECT(widget),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8122 gtkwin->drag_leave_signal);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8123 gtkwin->drag_leave_signal = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8124 }
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 if (cursor == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8127 cursor = gdk_cursor_new(GDK_FLEUR);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8128
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8129 /* Grab the pointer */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8130 gtk_grab_add(gtkwin->notebook);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8131 #ifndef _WIN32
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8132 /* 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
8133 always be true after a button press. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8134 if (!gdk_pointer_is_grabbed())
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8135 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8136 gdk_pointer_grab(gtkwin->notebook->window, FALSE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8137 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
8138 NULL, cursor, GDK_CURRENT_TIME);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8139 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8140
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8141 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8142 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
8143 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8144
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8145 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8146 * 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
8147 * drag to be initiated.
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 if (win->in_predrag) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8150 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
8151 e->x_root >= win->drag_max_x ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8152 e->y_root < win->drag_min_y ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8153 e->y_root >= win->drag_max_y) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8154
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8155 win->in_predrag = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8156 notebook_init_grab(win, widget);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8157 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8158 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8159 else { /* Otherwise, draw the arrows. */
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8160 PidginWindow *dest_win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8161 GtkNotebook *dest_notebook;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8162 GtkWidget *tab;
17112
bee4ea11e299 Fix the tab-dragging arrows in conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17111
diff changeset
8163 gint page_num;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8164 gboolean horiz_tabs = FALSE;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8165 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8166 gboolean to_right = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8167
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8168 /* 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
8169 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
8170
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8171 if (dest_win == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8172 dnd_hints_hide_all();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8173
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8174 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8175 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8176
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8177 dest_notebook = GTK_NOTEBOOK(dest_win->notebook);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8178
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8179 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
8180 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
8181 to_right = to_right && (win != dest_win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8182
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8183 if (gtk_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
8184 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
8185 horiz_tabs = TRUE;
bee4ea11e299 Fix the tab-dragging arrows in conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17111
diff changeset
8186 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8187
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8188 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
8189 tab = gtkconv->tabby;
19235
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8190 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
8191 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
8192 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
8193 } else if (horiz_tabs) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8194 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
8195 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
8196 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
8197 } else {
bee4ea11e299 Fix the tab-dragging arrows in conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17111
diff changeset
8198 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
8199 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
8200 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8201 } else {
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_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
8204 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
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_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
8207 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
8208 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8209 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8210 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8211
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8212 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8213 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8214
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8215 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8216 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
8217 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8218 if (win->in_drag)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8219 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8220
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8221 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
8222 e->x_root >= win->drag_max_x ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8223 e->y_root < win->drag_min_y ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8224 e->y_root >= win->drag_max_y) {
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 win->in_predrag = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8227 notebook_init_grab(win, widget);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8230 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8231 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8232
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8233 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8234 * THANK YOU GALEON!
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8235 */
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
8236
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
8237 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
8238 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
8239 {
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
8240 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
8241 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
8242 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
8243 }
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
8244
18523
0a8f9829640f Show the 'send to' menu on right click on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18465
diff changeset
8245 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
8246 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
8247
19235
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8248 if (e->button == 1) {
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8249 int nb_x, nb_y;
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8250
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8251 if (gtkconv->win->in_drag)
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8252 return TRUE;
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8253
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8254 gtkconv->win->in_predrag = TRUE;
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8255 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
8256
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8257 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
8258
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8259 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
8260 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
8261 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
8262 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
8263
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8264 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
8265 G_CALLBACK(notebook_motion_cb), gtkconv->win);
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8266 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
8267 G_CALLBACK(notebook_leave_cb), gtkconv->win);
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8268 return FALSE;
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8269 }
f243a10045e2 Allow drag and drop from infopane
Sean Egan <seanegan@gmail.com>
parents: 19234
diff changeset
8270
18523
0a8f9829640f Show the 'send to' menu on right click on the infopane.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18465
diff changeset
8271 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
8272 /* 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
8273 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
8274 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
8275 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
8276
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
8277 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
8278 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
8279 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
8280 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
8281 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
8282 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
8283 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
8284 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
8285 } 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
8286 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
8287 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
8288 }
1987beefd494 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18656
diff changeset
8289
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_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
8291 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
8292 return TRUE;
18671
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
8293 }
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
8294 return FALSE;
18671
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
8295 }
30b6f8bc47cf Tooltips in infopanes
Sean Egan <seanegan@gmail.com>
parents: 18658
diff changeset
8296
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8297 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8298 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
8299 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8300 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
8301 int tab_clicked;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8302 GtkWidget *page;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8303 GtkWidget *tab;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8304
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
8305 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
8306 PidginConversation *gtkconv;
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8307 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
8308
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8309 if (tab_clicked == -1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8310 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8311
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8312 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
8313 close_conv_cb(NULL, NULL, gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8314 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8315 }
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8318 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
8319 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8320
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8321
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8322 if (win->in_drag) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8323 purple_debug(PURPLE_DEBUG_WARNING, "gtkconv",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8324 "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
8325 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8326 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8327
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 * 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
8330 * mess things up.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8331 */
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8332 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
8333
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8334 if (tab_clicked == -1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8335 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8336
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8337 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8338 * 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
8339 * the position of the notebook.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8340 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8341 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
8342
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8343 x_rel = e->x_root - nb_x;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8344 y_rel = e->y_root - nb_y;
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 /* Reset the min/max x/y */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8347 win->drag_min_x = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8348 win->drag_min_y = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8349 win->drag_max_x = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8350 win->drag_max_y = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8351
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8352 /* Find out which tab was dragged. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8353 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
8354 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
8355
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8356 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
8357 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
8358 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
8359 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
8360
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8361 /* 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
8362 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
8363 e->x_root >= win->drag_max_x ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8364 e->y_root < win->drag_min_y ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8365 e->y_root >= win->drag_max_y) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8366
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8367 return FALSE;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8370 win->in_predrag = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8371 win->drag_tab = tab_clicked;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8372
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8373 /* Connect the new motion signals. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8374 win->drag_motion_signal =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8375 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
8376 G_CALLBACK(notebook_motion_cb), win);
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->drag_leave_signal =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8379 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
8380 G_CALLBACK(notebook_leave_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8381
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8382 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8383 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8384
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8385 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8386 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
8387 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8388 PidginWindow *dest_win;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8389 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8390 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8391 gint dest_page_num = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8392 gboolean new_window = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8393 gboolean to_right = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8394
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8395 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8396 * 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
8397 * 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
8398 * close button.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8399 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8400 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
8401 return 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 if (gdk_pointer_is_grabbed()) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8404 gdk_pointer_ungrab(GDK_CURRENT_TIME);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8405 gtk_grab_remove(widget);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8406 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8407
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8408 if (!win->in_predrag && !win->in_drag)
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 /* Disconnect the motion signal. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8412 if (win->drag_motion_signal) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8413 g_signal_handler_disconnect(G_OBJECT(widget),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8414 win->drag_motion_signal);
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 win->drag_motion_signal = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8417 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8418
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8419 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8420 * 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
8421 * signal.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8422 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8423 if (win->in_predrag) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8424 win->in_predrag = FALSE;
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 if (win->drag_leave_signal) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8427 g_signal_handler_disconnect(G_OBJECT(widget),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8428 win->drag_leave_signal);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8429
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8430 win->drag_leave_signal = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8431 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8432 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8433
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8434 /* If we're not in drag... */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8435 /* We're perfectly normal people! */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8436 if (!win->in_drag)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8437 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8438
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8439 win->in_drag = FALSE;
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 dnd_hints_hide_all();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8442
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8443 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
8444
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8445 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
8446
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8447 if (dest_win == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8448 /* 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
8449 * 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
8450 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
8451 /* 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
8452 dest_win = pidgin_conv_window_new();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8453 new_window = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8454 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8455 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8456
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8457 if (dest_win == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8458 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8459
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8460 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
8461 "conversation-dragging", win, dest_win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8462
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8463 /* Get the destination page number. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8464 if (!new_window)
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8465 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
8466 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
8467
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8468 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
8469
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8470 if (win == dest_win) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8471 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
8472 } else {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8473 pidgin_conv_window_remove_gtkconv(win, gtkconv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8474 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
8475 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
8476 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
8477 if (new_window) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8478 gint win_width, win_height;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8479
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8480 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
8481 &win_width, &win_height);
19614
16776040e347 ifdef win32 the conversation placement code
Sean Egan <seanegan@gmail.com>
parents: 19600
diff changeset
8482 #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
8483 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
8484 e->x_root - (win_width / 2),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8485 e->y_root - (win_height / 2));
19614
16776040e347 ifdef win32 the conversation placement code
Sean Egan <seanegan@gmail.com>
parents: 19600
diff changeset
8486 #endif
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8487
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8488 pidgin_conv_window_show(dest_win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8489 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8490 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8491
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8492 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
8493
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8494 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8495 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8496
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 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8499 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
8500 gpointer user_data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8501 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8502 PidginWindow *win;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8503 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8504 PidginConversation *gtkconv;
15374
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 win = user_data;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8507 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
8508
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8509 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8510
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8511 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
8512 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8513
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8514 gtkconv = PIDGIN_CONVERSATION(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8515
17278
591d6c3e9f1f Stop the typing icon timer before switching conversations so the typing
Stu Tomlinson <stu@nosnilmot.com>
parents: 17257
diff changeset
8516 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
8517 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
8518 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
8519 }
591d6c3e9f1f Stop the typing icon timer before switching conversations so the typing
Stu Tomlinson <stu@nosnilmot.com>
parents: 17257
diff changeset
8520
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8521 stop_anim(NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8522 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8523 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8524 close_window(GtkWidget *w, PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8525 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8526 close_win_cb(w, NULL, win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8527 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8528
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8529 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8530 detach_tab_cb(GtkWidget *w, GObject *menu)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8531 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8532 PidginWindow *win, *new_window;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8533 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8534
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8535 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
8536
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8537 if (!gtkconv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8538 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8539
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8540 win = pidgin_conv_get_window(gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8541 /* 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
8542 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
8543 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8544
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8545 pidgin_conv_window_remove_gtkconv(win, gtkconv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8546
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8547 new_window = pidgin_conv_window_new();
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8548 pidgin_conv_window_add_gtkconv(new_window, gtkconv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8549 pidgin_conv_window_show(new_window);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8550 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8551
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8552 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8553 close_others_cb(GtkWidget *w, GObject *menu)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8554 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8555 GList *iter;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8556 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8557 PidginWindow *win;
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 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
8560
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8561 if (!gtkconv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8562 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8563
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8564 win = pidgin_conv_get_window(gtkconv);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8565
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8566 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
8567 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8568 PidginConversation *gconv = iter->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8569 iter = iter->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8570
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8571 if (gconv != gtkconv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8572 {
18797
0622a7f08dde smaller close buttons on tabs. I think this looks really good.
Sean Egan <seanegan@gmail.com>
parents: 18796
diff changeset
8573 close_conv_cb(NULL, NULL, gconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8574 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8575 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8576 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8577
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8578 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
8579 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8580 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8581
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8582 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
8583
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8584 if (gtkconv)
18797
0622a7f08dde smaller close buttons on tabs. I think this looks really good.
Sean Egan <seanegan@gmail.com>
parents: 18796
diff changeset
8585 close_conv_cb(NULL, NULL, gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8586 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8587
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8588 static gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8589 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
8590 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8591 GtkWidget *item, *menu;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8592 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8593
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8594 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
8595 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8596
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8597 gtkconv = pidgin_conv_window_get_gtkconv_at_index(win,
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8598 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
8599
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8600 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
8601 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8602 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
8603 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8604 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8605
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8606 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
8607
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8608 menu = notebook->menu;
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
8609 pidgin_separator(GTK_WIDGET(menu));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8610
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8611 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
8612 gtk_widget_show(item);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8613 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
8614 g_signal_connect(G_OBJECT(item), "activate",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8615 G_CALLBACK(close_others_cb), menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8616
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8617 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
8618 gtk_widget_show(item);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8619 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
8620 g_signal_connect(G_OBJECT(item), "activate",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8621 G_CALLBACK(close_window), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8622
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15505
diff changeset
8623 pidgin_separator(menu);
15374
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(_("Detach this tab"));
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(detach_tab_cb), menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8630
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8631 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
8632 gtk_widget_show(item);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8633 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
8634 g_signal_connect(G_OBJECT(item), "activate",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8635 G_CALLBACK(close_tab_cb), menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8636
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8637 return FALSE;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8640 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
8641 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
8642 {
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8643 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
8644 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
8645 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
8646 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
8647 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
8648 }
e7ad18acc238 "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
e7ad18acc238 "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 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
8651 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
8652 {
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8653 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
8654 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
8655 }
e7ad18acc238 "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 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
8658 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
8659 {
e7ad18acc238 "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 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
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 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
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 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
8665 }
e7ad18acc238 "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
e7ad18acc238 "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 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
8668 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
8669 {
e7ad18acc238 "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 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
8671 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
8672 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
8673 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
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 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
8676 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
8677 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
8678 }
e7ad18acc238 "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 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
8680 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
8681 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
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 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
8684 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
8685 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
8686 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
8687 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
8688 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
8689 }
e7ad18acc238 "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 serv_alias_buddy(buddy);
21731
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8691 } 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
8692 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
8693 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
8694 }
e7ad18acc238 "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 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
8696 }
e7ad18acc238 "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 static gboolean
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8699 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
8700 {
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8701 GtkWidget *entry = NULL;
21731
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8702 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
8703 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
8704
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
8705 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
8706 /* 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
8707 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
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
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
8710 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
8711 /* 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
8712 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
8713 }
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
8714
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
8715 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
8716 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
8717 if (!buddy)
21731
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8718 /* 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
8719 return FALSE;
21731
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8720
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
8721 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
8722 } 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
8723 PurpleConnection *gc;
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8724 PurplePluginProtocolInfo *prpl_info = NULL;
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8725
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8726 gc = purple_conversation_get_gc(conv);
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8727 if (gc != NULL)
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8728 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8729 if (prpl_info && prpl_info->set_chat_topic == NULL)
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8730 /* 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
8731 return FALSE;
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8732
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
8733 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
8734 }
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
8735
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
8736 /* 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
8737 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
8738 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
8739 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
8740 #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
8741 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
8742 #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
8743
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
8744 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
8745 /* 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
8746 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
8747
e7ad18acc238 "Clicking on a buddy name in a chat window should alias the name", patch
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17092
diff changeset
8748 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
8749 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
8750 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
8751
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8752 if (text != NULL)
ea32d04d87dd Fix a few assertion failures:
Mark Doliner <mark@kingant.net>
parents: 21710
diff changeset
8753 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
8754 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
8755 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
8756 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
8757
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8758 return TRUE;
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8759 }
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8760
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8761 static gboolean
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8762 window_keypress_cb(GtkWidget *widget, GdkEventKey *event, PidginWindow *win)
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8763 {
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8764 PidginConversation *gtkconv = pidgin_conv_window_get_active_gtkconv(win);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8765
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8766 return conv_keypress_common(gtkconv, event);
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
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
8769 static void
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8770 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
8771 gpointer user_data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8772 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8773 PidginWindow *win;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8774 PurpleConversation *conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8775 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8776 const char *sound_method;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8777
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8778 win = user_data;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8779 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
8780 conv = gtkconv->active_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8781
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8782 g_return_if_fail(conv != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8783
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8784 /* clear unseen flag if conversation is not hidden */
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8785 if(!pidgin_conv_is_hidden(gtkconv)) {
15505
762b6547adf9 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents: 15502
diff changeset
8786 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
8787 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8788
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8789 /* Update the menubar */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8790
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8791 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
8792 purple_conversation_is_logging(conv));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8793
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8794 generate_send_to_items(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8795 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
8796 regenerate_plugins_items(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8797
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
8798 pidgin_conv_switch_active_conversation(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8799
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
8800 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
8801 if (strcmp(sound_method, "none") != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8802 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
8803 gtkconv->make_sound);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8804
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8805 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
8806 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
8807
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8808 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
8809 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
8810
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8811 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8812 * 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
8813 * 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
8814 */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8815 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
8816 (gtkconv->u.im->animate))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8817 start_anim(NULL, gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8818
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
8819 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
8820 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8821
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8822 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8823 * GTK+ window ops
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8824 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8825
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8826 GList *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8827 pidgin_conv_windows_get_list()
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 return window_list;
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
16315
ee4ce3c4186f Fix #248 (Control shouldn't steal focus from scrollback)
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16286
diff changeset
8832 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
8833 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
8834 {
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8835 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
8836 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
8837 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
8838 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
8839 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
8840 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
8841 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
8842 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
8843 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
8844 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
8845 }
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8846
16315
ee4ce3c4186f Fix #248 (Control shouldn't steal focus from scrollback)
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16286
diff changeset
8847 static void
ee4ce3c4186f Fix #248 (Control shouldn't steal focus from scrollback)
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16286
diff changeset
8848 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
8849 {
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8850 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
8851 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
8852 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
8853 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
8854 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
8855 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
8856 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
8857 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
8858 }
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8859
17392
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
8860 static void
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
8861 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
8862 {
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
8863 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
8864 }
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
8865
18328
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8866 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
8867 int x, y;
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8868
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8869 if (GTK_WIDGET_VISIBLE(w))
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8870 gtk_window_get_position(GTK_WINDOW(w), &x, &y);
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8871 else
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8872 return FALSE; /* carry on normally */
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8873
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8874 /* Workaround for GTK+ bug # 169811 - "configure_event" is fired
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8875 * when the window is being maximized */
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8876 if (gdk_window_get_state(w->window) & GDK_WINDOW_STATE_MAXIMIZED)
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8877 return FALSE;
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8878
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8879 /* don't save off-screen positioning */
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8880 if (x + event->width < 0 ||
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8881 y + event->height < 0 ||
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8882 x > gdk_screen_width() ||
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8883 y > gdk_screen_height())
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8884 return FALSE; /* carry on normally */
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8885
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
8886 /* 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
8887 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
8888 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
8889 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
8890 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
8891
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8892 /* continue to handle event normally */
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8893 return FALSE;
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8894
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8895 }
df4ae80156d2 Handle size saving
Sean Egan <seanegan@gmail.com>
parents: 18327
diff changeset
8896
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
8897 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
8898 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
8899 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
8900 {
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
8901 /* 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
8902 * 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
8903 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
8904 !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
8905
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
8906 /* ...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
8907 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
8908 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
8909 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
8910 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
8911
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
8912 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
8913 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
8914 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
8915 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
8916
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
8917 /* ...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
8918 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
8919 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
8920 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
8921 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
8922
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
8923 static void
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
8924 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
8925 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
8926 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
8927 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
8928 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
8929 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
8930 }
672dd03f538a More work on the conversation sizing/positioning stuff. Still nothing IM or chat specific
Sean Egan <seanegan@gmail.com>
parents: 18621
diff changeset
8931
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8932 PidginWindow *
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8933 pidgin_conv_window_new()
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8934 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8935 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8936 GtkPositionType pos;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8937 GtkWidget *testidea;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8938 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
8939 #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
8940 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
8941 #endif
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8942
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
8943 win = g_malloc0(sizeof(PidginWindow));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8944
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8945 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
8946
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8947 /* Create the window. */
17166
92c3c2eeba87 Added to gtkutils.c:
Gabriel Schulhof <nix@go-nix.ca>
parents: 17116
diff changeset
8948 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
8949 #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
8950 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
8951 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
8952 #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
8953 pidgin_conv_restore_position(win);
17260
baaf2cf9339c disapproval of revision '1f819f5ad330efa81ac7906f854b46f0c8bbd7b6'
Ethan Blanton <elb@pidgin.im>
parents: 17259
diff changeset
8954
15723
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8955 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
8956 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
8957 }
8797ee49609f multiple-sized status icons for window icons. Still need to do prpl icons
Sean Egan <seanegan@gmail.com>
parents: 15699
diff changeset
8958
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8959 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
8960 G_CALLBACK(close_win_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8961 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
8962 G_CALLBACK(focus_win_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8963
19587
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8964 /* Intercept keystrokes from the menu items */
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8965 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
8966 G_CALLBACK(window_keypress_cb), win);
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8967
f34b2e651454 Patch from fmoo. Fixes #1280
Sean Egan <seanegan@gmail.com>
parents: 19559
diff changeset
8968
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8969 /* Create the notebook. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8970 win->notebook = gtk_notebook_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8971
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 16007
diff changeset
8972 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
8973
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8974 #if 0
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8975 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
8976 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
8977 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8978 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
8979 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
8980 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
8981 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
8982 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
8983
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8984 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
8985 G_CALLBACK(right_click_menu_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8986
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8987 gtk_widget_show(win->notebook);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8988
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8989 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
8990 G_CALLBACK(before_switch_conv_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8991 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
8992 G_CALLBACK(switch_conv_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8993
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8994 /* Setup the tab drag and drop signals. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8995 gtk_widget_add_events(win->notebook,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8996 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
8997 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
8998 G_CALLBACK(notebook_press_cb), win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8999 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
9000 G_CALLBACK(notebook_release_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 testidea = gtk_vbox_new(FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9003
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9004 /* Setup the menubar. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9005 menubar = setup_menubar(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9006 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
9007
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9008 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
9009
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9010 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
9011
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9012 gtk_widget_show(testidea);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9013
17392
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
9014 /* 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
9015 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
9016 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
9017 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
9018 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
9019
d48026a5f9dd Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17391
diff changeset
9020
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9021 #ifdef _WIN32
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9022 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
9023 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
9024
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
9025 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
9026 && !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
9027 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
9028 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9029
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9030 return win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9031 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9032
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9033 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9034 pidgin_conv_window_destroy(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9035 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9036 purple_prefs_disconnect_by_handle(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9037 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
9038
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9039 /* 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
9040 if (win->dialogs.search)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9041 gtk_widget_destroy(win->dialogs.search);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9042
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9043 if (win->gtkconvs) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9044 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
9045 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
9046 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
9047 if (last)
fee0eea83e58 Honour the persistency when closing the window from the WM.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20051
diff changeset
9048 break;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9049 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9050 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9051 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9052 gtk_widget_destroy(win->window);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9053
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9054 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
9055
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9056 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
9057 purple_signals_disconnect_by_handle(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9058
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9059 g_free(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9060 }
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 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9063 pidgin_conv_window_show(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9064 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9065 gtk_widget_show(win->window);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9068 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9069 pidgin_conv_window_hide(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9070 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9071 gtk_widget_hide(win->window);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9074 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9075 pidgin_conv_window_raise(PidginWindow *win)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9076 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9077 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
9078 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9079
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9080 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9081 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
9082 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9083 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
9084 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
9085 gtkconv->tab_cont));
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
18864
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9088 static gboolean
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9089 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
9090 {
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
9091 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
9092 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
9093 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
9094 }
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
9095
18864
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9096 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
9097 gdk_window_set_cursor(event->window, ptr);
18864
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9098 return FALSE;
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9099 }
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9100
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9101 static gboolean
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9102 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
9103 {
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
9104 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
9105 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
9106 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
9107 }
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
9108
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
9109 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
9110 gdk_window_set_cursor(event->window, hand);
18864
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9111 return FALSE;
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9112 }
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9113
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9114 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9115 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
9116 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9117 PurpleConversation *conv = gtkconv->active_conv;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9118 PidginConversation *focus_gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9119 GtkWidget *tab_cont = gtkconv->tab_cont;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9120 GtkWidget *close_image;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9121 PurpleConversationType conv_type;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9122 const gchar *tmp_lab;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9123
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9124 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
9125
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9126 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
9127 gtkconv->win = win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9128
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
9129 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
9130 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
9131
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
9132
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9133 /* Close button. */
18797
0622a7f08dde smaller close buttons on tabs. I think this looks really good.
Sean Egan <seanegan@gmail.com>
parents: 18796
diff changeset
9134 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
9135 #if GTK_CHECK_VERSION(2,4,0)
18821
0765cf9331f6 warning fixes
Sean Egan <seanegan@gmail.com>
parents: 18820
diff changeset
9136 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
9137 #endif
18864
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9138 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
9139 close_image = gtk_label_new("×");
18864
c4505e3efa9a Bold the x on mouse over
Sean Egan <seanegan@gmail.com>
parents: 18863
diff changeset
9140 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
9141 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
9142 gtk_widget_show(close_image);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9143 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
9144 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
9145 _("Close conversation"), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9146
18797
0622a7f08dde smaller close buttons on tabs. I think this looks really good.
Sean Egan <seanegan@gmail.com>
parents: 18796
diff changeset
9147 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
9148 G_CALLBACK(close_conv_cb), gtkconv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9149
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9150 #if !GTK_CHECK_VERSION(2,6,0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9151 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9152 * 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
9153 * border bug. I love you guys! -- ChipX86
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9154 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9155 /* 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
9156 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
9157 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
9158 #endif
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 /* Status icon. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9161 gtkconv->icon = gtk_image_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9162 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
9163 gtk_widget_show(gtkconv->icon);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9164 update_tab_icon(conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9165
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9166 /* Tab label. */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9167 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
9168 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
9169
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9170 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
9171 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
9172 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
9173
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9174 gtk_widget_show_all(gtkconv->menu_icon);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9175
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9176 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
9177 gtk_widget_show(gtkconv->menu_label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9178 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
9179
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9180 gtk_widget_show(gtkconv->menu_tabby);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9181
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9182 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
9183 pidgin_conv_update_buddy_icon(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9184
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9185 /* Build and set conversations tab */
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9186 pidgin_conv_tab_pack(win, gtkconv);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9187
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9188 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
9189
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9190 gtk_widget_show(tab_cont);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9191
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9192 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
9193 /* 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
9194 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
9195 } else {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9196 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
9197 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9198
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9199 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
9200 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
9201 gtk_widget_grab_focus(focus_gtkconv->entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9202
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9203 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
9204 update_send_to_selection(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9205 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9206
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9207 static void
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9208 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
9209 {
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9210 gboolean tabs_side = FALSE;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9211 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
9212 GtkWidget *first, *third, *ebox;
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9213
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9214 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
9215 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
9216 tabs_side = TRUE;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9217 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
9218 angle = 90;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9219 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
9220 angle = 270;
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 GTK_CHECK_VERSION(2,6,0)
19361
272d08484f7d remove obsolote GNOME color pallete
Sean Egan <seanegan@gmail.com>
parents: 19335
diff changeset
9223 if (!angle) {
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9224 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
9225 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
9226 } else {
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9227 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
9228 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
9229 }
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
9230
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9231 if (tabs_side) {
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9232 gtk_label_set_width_chars(
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9233 GTK_LABEL(gtkconv->tab_label),
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9234 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
9235 );
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9236 }
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
9237
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
9238 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
9239 #endif
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9240
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9241 #if 0
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9242 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
9243 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
9244 #endif
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9245
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9246 if (angle)
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9247 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
9248 else
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9249 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
9250 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
9251
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9252 /* select the correct ordering for verticle tabs */
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9253 if (angle == 90) {
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9254 first = gtkconv->close;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9255 third = gtkconv->icon;
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 first = gtkconv->icon;
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9258 third = gtkconv->close;
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
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
9261 ebox = gtk_event_box_new();
17423
ae30f9913bb4 Fix for gtk < 2.4
Stu Tomlinson <stu@nosnilmot.com>
parents: 17294
diff changeset
9262 #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
9263 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
9264 #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
9265 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
9266
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9267 if (gtkconv->tab_label->parent == NULL) {
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9268 /* Pack if it's a new widget */
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9269 gtk_box_pack_start(GTK_BOX(gtkconv->tabby), first, FALSE, FALSE, 0);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9270 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
9271 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
9272
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9273 /* 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
9274 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
9275 } else {
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9276 /* reparent old widgets on preference changes */
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9277 gtk_widget_reparent(first, gtkconv->tabby);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9278 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
9279 gtk_widget_reparent(third, gtkconv->tabby);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9280 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
9281 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
9282 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
9283
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9284 /* 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
9285 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
9286 }
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9287
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
9288 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
9289 !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
9290 TRUE, GTK_PACK_START);
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9291
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
9292 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
9293 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
9294 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
9295 (!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
9296 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
9297
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9298 /* 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
9299 /* gtk_widget_show(gtkconv->icon); */
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9300 gtk_widget_show(gtkconv->tab_label);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9301 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
9302 gtk_widget_show(gtkconv->close);
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9303 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
9304 gtk_widget_show(ebox);
17045
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9305 }
d2353e780fd5 Patch #363 Fix for tab packing problem
Sean Egan <seanegan@gmail.com>
parents: 17002
diff changeset
9306
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9307 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9308 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
9309 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9310 unsigned int index;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9311 PurpleConversationType conv_type;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9312
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9313 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
9314 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
9315
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9316 g_object_ref(gtkconv->tab_cont);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9317 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
9318
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9319 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
9320
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9321 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
9322
19681
c35e8c057441 Fix a crash in window-placement.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19680
diff changeset
9323 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
9324 0, 0, NULL, NULL, gtkconv);
c35e8c057441 Fix a crash in window-placement.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19680
diff changeset
9325
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
9326 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
9327 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
9328
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9329 if (!win->gtkconvs && win != hidden_convwin)
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9330 pidgin_conv_window_destroy(win);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9331 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9332
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9333 PidginConversation *
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9334 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
9335 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9336 GtkWidget *tab_cont;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9337
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9338 if (index == -1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9339 index = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9340 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
9341 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
9342 }
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9343
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9344 PidginConversation *
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9345 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
9346 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9347 int index;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9348 GtkWidget *tab_cont;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9349
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9350 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
9351 if (index == -1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9352 index = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9353 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
9354 if (!tab_cont)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9355 return NULL;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9356 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
9357 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9358
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9359
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9360 PurpleConversation *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9361 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
9362 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9363 PidginConversation *gtkconv;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9364
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9365 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
9366 return gtkconv ? gtkconv->active_conv : NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9367 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9368
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9369 gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9370 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
9371 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9372 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
9373 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9375 gboolean
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9376 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
9377 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9378 gboolean has_focus = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9379
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9380 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
9381
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9382 return has_focus;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9383 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9384
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9385 PidginWindow *
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9386 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
9387 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9388 PidginWindow *win;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9389 GdkWindow *gdkwin;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9390 GList *l;
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 gdkwin = gdk_window_at_pointer(&x, &y);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9393
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9394 if (gdkwin)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9395 gdkwin = gdk_window_get_toplevel(gdkwin);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9396
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9397 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
9398 win = l->data;
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 if (gdkwin == win->window->window)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9401 return win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9402 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9403
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9404 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9405 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9406
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9407 GList *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9408 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
9409 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9410 return win->gtkconvs;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9413 guint
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9414 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
9415 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9416 return g_list_length(win->gtkconvs);
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
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9419 PidginWindow *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9420 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
9421 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9422 GList *wins, *convs;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9423 PidginWindow *win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9424 PidginConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9425
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9426 if (type == PURPLE_CONV_TYPE_UNKNOWN)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9427 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9428
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9429 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
9430 win = wins->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9431
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9432 for (convs = win->gtkconvs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9433 convs != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9434 convs = convs->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9435
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9436 conv = convs->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9437
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9438 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
9439 return win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9440 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9441 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9442
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9443 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9444 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9445
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9446 PidginWindow *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9447 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
9448 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9449 GList *wins, *convs;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9450 PidginWindow *win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9451 PidginConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9452
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9453 if (type == PURPLE_CONV_TYPE_UNKNOWN)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9454 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9455
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9456 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
9457 wins != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9458 wins = wins->prev) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9459
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9460 win = wins->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9461
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9462 for (convs = win->gtkconvs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9463 convs != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9464 convs = convs->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9465
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9466 conv = convs->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9467
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9468 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
9469 return win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9470 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9471 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9472
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9473 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9474 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9475
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9476
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9477 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9478 * Conversation placement functions
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 typedef struct
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9481 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9482 char *id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9483 char *name;
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
9484 PidginConvPlacementFunc fnc;
15374
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 } ConvPlacementData;
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 static GList *conv_placement_fncs = NULL;
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
9489 static PidginConvPlacementFunc place_conv = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9490
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9491 /* 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
9492 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9493 conv_placement_last_created_win(PidginConversation *conv)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9494 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9495 PidginWindow *win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9496
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9497 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
9498 win = l ? l->data : NULL;;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9499
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9500 if (win == NULL) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9501 win = pidgin_conv_window_new();
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9502
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9503 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
9504 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
9505
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9506 pidgin_conv_window_add_gtkconv(win, conv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9507 pidgin_conv_window_show(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9508 } else {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9509 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
9510 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9511 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9512
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9513 /* 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
9514 static gboolean
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9515 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
9516 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
9517 {
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9518 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
9519 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
9520 GList *all;
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9521
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9522 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
9523 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
9524 else
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9525 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
9526
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9527 /* 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
9528 * 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
9529 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
9530 return FALSE;
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9531
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9532 /* 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
9533 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
9534 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
9535 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
9536 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
9537 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
9538
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9539 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
9540 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
9541 /* 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
9542 return FALSE;
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9543 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9544 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9545
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9546 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
9547 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
9548 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
9549 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
9550 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
9551 } 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
9552 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
9553 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
9554 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
9555 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
9556 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9557
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9558 return FALSE;
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9559 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9560
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9561 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9562 conv_placement_last_created_win_type(PidginConversation *conv)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9563 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9564 PidginWindow *win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9565
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9566 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
9567
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9568 if (win == NULL) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9569 win = pidgin_conv_window_new();
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9570
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9571 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
9572 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
9573 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
9574 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
9575 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
9576 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
9577 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
9578 } 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
9579 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
9580 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
9581 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
9582 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
9583 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
9584 }
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9585
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9586 pidgin_conv_window_add_gtkconv(win, conv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9587 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
9588
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9589 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
9590 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
9591 } else
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9592 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
9593 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9594
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9595 /* 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
9596 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9597 conv_placement_new_window(PidginConversation *conv)
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9598 {
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9599 PidginWindow *win;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9600
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9601 win = pidgin_conv_window_new();
18791
f36fc45b7866 really make restoring size and position work
Ka-Hing Cheung <khc@hxbc.us>
parents: 18790
diff changeset
9602
18790
42161f9233bf remember chat/im windows sizes and positions separately by letting the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18787
diff changeset
9603 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
9604 G_CALLBACK(gtk_conv_configure_cb), NULL);
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9605
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9606 pidgin_conv_window_add_gtkconv(win, conv);
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9607
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9608 pidgin_conv_window_show(win);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9609 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9610
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9611 static PurpleGroup *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9612 conv_get_group(PidginConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9613 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9614 PurpleGroup *group = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9615
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9616 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
9617 PurpleBuddy *buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9618
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9619 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
9620 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
9621
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9622 if (buddy != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9623 group = purple_buddy_get_group(buddy);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9624
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9625 } 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
9626 PurpleChat *chat;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9627
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9628 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
9629 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
9630
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9631 if (chat != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9632 group = purple_chat_get_group(chat);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9633 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9634
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9635 return group;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9636 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9637
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 * 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
9640 * 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
9641 * open windows will get a new window.
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 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9644 conv_placement_by_group(PidginConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9645 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9646 PurpleConversationType type;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9647 PurpleGroup *group = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9648 GList *wl, *cl;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9649
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9650 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
9651
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9652 group = conv_get_group(conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9653
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9654 /* 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
9655 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
9656 PidginWindow *win2;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9657 PidginConversation *conv2;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9658 PurpleGroup *group2 = NULL;
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 win2 = wl->data;
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 for (cl = win2->gtkconvs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9663 cl != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9664 cl = cl->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9665 conv2 = cl->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9666
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9667 group2 = conv_get_group(conv2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9668
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9669 if (group == group2) {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9670 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
9671
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9672 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9673 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9674 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9675 }
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 /* Make a new window. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9678 conv_placement_new_window(conv);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9681 /* 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
9682 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9683 conv_placement_by_account(PidginConversation *conv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9684 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9685 PurpleConversationType type;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9686 GList *wins, *convs;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9687 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9688
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9689 account = purple_conversation_get_account(conv->active_conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9690 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
9691
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9692 /* 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
9693 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
9694 PidginWindow *win2;
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
9695 PidginConversation *conv2;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9696
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9697 win2 = wins->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9698
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9699 for (convs = win2->gtkconvs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9700 convs != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9701 convs = convs->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9702 conv2 = convs->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9703
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9704 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
9705 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
9706 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9707 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9708 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9709 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9710
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9711 /* Make a new window. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9712 conv_placement_new_window(conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9713 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9714
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9715 static ConvPlacementData *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9716 get_conv_placement_data(const char *id)
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 ConvPlacementData *data = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9719 GList *n;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9720
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9721 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
9722 data = n->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9723 if (!strcmp(data->id, id))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9724 return data;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9727 return NULL;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9730 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9731 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
9732 PidginConvPlacementFunc fnc)
15374
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 ConvPlacementData *data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9735
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9736 data = g_new(ConvPlacementData, 1);
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 data->id = g_strdup(id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9739 data->name = g_strdup(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9740 data->fnc = fnc;
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 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
9743 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9744
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9745 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9746 ensure_default_funcs(void)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9747 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9748 if (conv_placement_fncs == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9749 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
9750 conv_placement_last_created_win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9751 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
9752 conv_placement_last_created_win_type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9753 add_conv_placement_fnc("new", _("New window"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9754 conv_placement_new_window);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9755 add_conv_placement_fnc("group", _("By group"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9756 conv_placement_by_group);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9757 add_conv_placement_fnc("account", _("By account"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9758 conv_placement_by_account);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9759 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9760 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9761
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9762 GList *
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9763 pidgin_conv_placement_get_options(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9764 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9765 GList *n, *list = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9766 ConvPlacementData *data;
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 ensure_default_funcs();
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 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
9771 data = n->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9772 list = g_list_append(list, data->name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9773 list = g_list_append(list, data->id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9774 }
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 return list;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9779
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9780 void
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9781 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
9782 PidginConvPlacementFunc fnc)
15374
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 g_return_if_fail(id != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9785 g_return_if_fail(name != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9786 g_return_if_fail(fnc != NULL);
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 ensure_default_funcs();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9789
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9790 add_conv_placement_fnc(id, name, fnc);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9793 void
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9794 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
9795 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9796 ConvPlacementData *data = get_conv_placement_data(id);
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 if (data == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9799 return;
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 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
9802
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9803 g_free(data->id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9804 g_free(data->name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9805 g_free(data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9806 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9807
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9808 const char *
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9809 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
9810 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9811 ConvPlacementData *data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9812
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9813 ensure_default_funcs();
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 data = get_conv_placement_data(id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9816
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9817 if (data == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9818 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9819
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9820 return data->name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9821 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9822
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
9823 PidginConvPlacementFunc
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9824 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
9825 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9826 ConvPlacementData *data;
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 ensure_default_funcs();
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 data = get_conv_placement_data(id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9831
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9832 if (data == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9833 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9834
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9835 return data->fnc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9836 }
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 void
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
9839 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
9840 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9841 g_return_if_fail(func != 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 /* 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
9844 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
9845 place_conv = func;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9846 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9847 place_conv = NULL;
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
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15749
diff changeset
9850 PidginConvPlacementFunc
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9851 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
9852 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9853 return place_conv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9854 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9855
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9856 void
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9857 pidgin_conv_placement_place(PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9858 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9859 if (place_conv)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9860 place_conv(gtkconv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9861 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9862 conv_placement_new_window(gtkconv);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9865 gboolean
15502
6fde15c1dcfc pidginconv to pidgin_conv
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
9866 pidgin_conv_is_hidden(PidginConversation *gtkconv)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9867 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9868 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
9869
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9870 return (gtkconv->win == hidden_convwin);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9874 /* 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
9875 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9876 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
9877 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9878 gulong fg_brightness;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9879 gulong bg_brightness;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9880 gulong br_diff;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9881 gulong col_diff;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9882 int fred, fgreen, fblue, bred, bgreen, bblue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9883
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9884 /* 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
9885 * 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
9886 * 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
9887 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9888
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9889 fred = foreground.red >> 8 ;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9890 fgreen = foreground.green >> 8 ;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9891 fblue = foreground.blue >> 8 ;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9892
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9893
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9894 bred = background.red >> 8 ;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9895 bgreen = background.green >> 8 ;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9896 bblue = background.blue >> 8 ;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9897
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9898 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
9899 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
9900 br_diff = abs(fg_brightness - bg_brightness);
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 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
9903
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9904 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
9905 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9906
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9907
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9908 static GdkColor*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9909 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
9910 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9911 guint numcolors = *color_count;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9912 guint i = 0, j = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9913 GdkColor *colors = g_new(GdkColor, numcolors);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9914 GdkColor nick_highlight;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9915 GdkColor send_color;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9916 time_t breakout_time;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9917
21840
9a39d47a9cd3 Another patch from DHowett. This one adds conversation nick colors to gtkrc
Sean Egan <seanegan@gmail.com>
parents: 21825
diff changeset
9918 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
9919 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
9920
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9921 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
9922
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9923 breakout_time = time(NULL) + 3;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9924
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9925 /* 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
9926 * 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
9927 * numcolors of them that do
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 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
9930 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9931 GdkColor color = nick_seed_colors[j];
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 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
9934 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
9935 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
9936 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9937 colors[i] = color;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9938 i++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9939 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9940 j++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9941 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9942
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9943 /* 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
9944 * 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
9945 * 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
9946 * conflict with each other.
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 while(i < numcolors && time(NULL) < breakout_time)
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 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
9951
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9952 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
9953 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
9954 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
9955 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9956 colors[i] = color;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9957 i++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9958 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9959 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9960
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9961 if (i < numcolors) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9962 GdkColor *c = colors;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
9963 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
9964 colors = g_memdup(c, i * sizeof(GdkColor));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9965 g_free(c);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9966 *color_count = i;
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 return colors;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9970 }